The error i'm getting is 'input string was not in the correct format' this is the code
static void Main(string[] args)
{
int numberOne;
int numberTwo;
int numberThree;
int numberFour;
int numberFive;
Console.WriteLine("Enter the first integer");
numberOne = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the second integer");
numberTwo = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the third integer");
numberThree = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the fourth integer");
numberFour = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the fifth integer");
numberFive = int.Parse(Console.ReadLine());
Arithmetic arithmetic = new Arithmetic();
arithmetic.ArithmeticMethod();
}
}
public void ArithmeticMethod()
{
int numberOne;
int numberTwo;
int numberThree;
int numberFour;
int numberFive;
numberOne = int.Parse(Console.ReadLine());
numberTwo = int.Parse(Console.ReadLine());
numberThree = int.Parse(Console.ReadLine());
numberFour = int.Parse(Console.ReadLine());
numberFive = int.Parse(Console.ReadLine());
Sum(numberOne, numberTwo, numberThree, numberFour, numberFive);
Average(numberOne, numberTwo, numberThree, numberFour, numberFive);
Product(numberOne, numberTwo, numberThree, numberFour, numberFive);
SmallestNumber(numberOne, numberTwo, numberThree, numberFour, numberFive);
LargestNumber(numberOne, numberTwo, numberThree, numberFour, numberFive);
}
public static int Sum(int numberOne, int numberTwo, int numberThree, int numberFour, int numberFive)
{
int sum;
sum = numberOne + numberTwo + numberThree + numberFour + numberFive;
Console.WriteLine($"the sum of the integers is {sum}");
return sum;
}
I'm really not sure what's going on.
What I have tried:
i've tried to cast it differently but nothing is really working.