This is my code, I am a beginner to C# but used to use python, my problem is that when the user enters their answer the variable answer adds what the user entered onto 48. I have no idea where the data 48 comes from but if the user enters 2 then it will make answer = 50.
Random numGen = new Random(); //importing random
int score = 0; //setting a variable
for (int i = 0; i < 10; i++) //for loop repeating 10 times
{
int num1 = numGen.Next(1, 11); // random number between 1 and 10
int num2 = numGen.Next(1, 11);
Console.WriteLine("What is " + num1 + " mutliplied by " + num2 + "? ");
//asking a multiplication question
int answer = 0;
answer = Console.Read(); //input answer
int result = num1 * num2;
if (result == answer) //checking answer is correct
{
Console.WriteLine("Well done that is correct!");
score = score + 1;
}
else
{
Console.WriteLine("Unlucky that was incorrect");
}
Console.WriteLine("Press enter for the next question");
Console.ReadKey(); //waits before closing
}