# How do i create this program only using C#?

edited October 2016 in C#

Children Math Game
Instructions

Randomize 2 number. Randomize a number between 1 and 3. 1 equal addition, 2 equals subtraction, 3 for multiplication

show the two plus the operation for the student to answer. Have the student input his answer. check and count the correct answers. Give 10 tries.

• By writing the code.

• Here is a small solution about your request. I made it as simple as possible, so you can edit it.

``````static void Main(string[] args)
{
int x = 1;
int y = 1;
int oper = 1;
string operation = "";
int correct = 0;
int wrong = 0;

Random rands = new Random();

for (int i = 1; i <= 10; i++)
{
oper = rands.Next(1, 4);

switch (oper)
{
case 1:
operation = "+";
x = rands.Next(1, 100);
y = rands.Next(1, 100);
break;
case 2:
operation = "-";
x = rands.Next(1, 100);
y = rands.Next(1, 100);
break;
case 3:
operation = "*";
x = rands.Next(1, 10);
y = rands.Next(1, 10);
break;
default:
break;
}
Console.Write("Try {3}:\t{0} {1} {2} = ", x, operation, y, i);
try
{
}
catch (Exception)
{

Console.WriteLine("That was not a number!");
}

{
Console.WriteLine("Correct!");
correct++;
}
else
{
Console.WriteLine("Wrong...");
wrong++;
}
}
Console.WriteLine("\n--------------------------------------------------\n");
switch (correct)
{
case 10:
Console.WriteLine("You are excellent!!!!");
break;
case 9:
case 8:
case 7:
Console.WriteLine("You are very good!");
break;
case 6:
case 5:
case 4:
Console.WriteLine("You are good, let's try a little more");
break;
default:
Console.WriteLine("You need more practice");
break;
}