kan i finde fejlen
hej expJeg er lige startet på noget fjernundervisning i C#. Min lærer er lidt lang tid om at svare så jeg prøver her. Jeg får en fejl I den nederste blok, eller rettere flere men jeg kan ikke rigtigt lure den, kan i ? det er denne blok
public static int subtraction (int a, int b)
int subtractionTotal;
subtractionTotal = a - b;
return subtractionTotal;
Her er hele koden
using System;
/*
* This class finds the sum, product,
* min and max of two numbers
*/
public class SimpleCalculator
{
public static void Main()
{
int x;
int y;
Console.Write("Enter first number: ");
x = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter second number: ");
y = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("The sum is: " + Sum(x, y));
Console.WriteLine("The product is: " + Product(x, y));
Console.WriteLine("The maximum number is: " + Math.Max(x, y));
Console.WriteLine("The minimum number is: " + Math.Min(x, y));
Console.WriteLine ("Subtraction result is:" + subtraction (x, y));
System.Console.ReadLine ();
}
// Sum calculates the sum of two int's
public static int Sum(int a, int b)
{
int sumTotal;
sumTotal = a + b;
return sumTotal;
}
// Product calculates the product of two int's
public static int Product(int a, int b)
{
int productTotal;
productTotal = a * b;
return productTotal;
}
// her er så mit forsøg
{
public static int subtraction (int a, int b)
int subtractionTotal;
subtractionTotal = a - b;
return subtractionTotal;
}
}
