Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cwake/8b08bbe014ff8e84c8aacdcceca7524d to your computer and use it in GitHub Desktop.
Save cwake/8b08bbe014ff8e84c8aacdcceca7524d to your computer and use it in GitHub Desktop.
Computer-Assisted Instruction
using System;
class p739
{
static void Main(string[] args)
{
int answer = generateQuestion();
int user = Convert.ToInt32(Console.ReadLine());
if (user == answer)
{
Console.WriteLine("Very good!");
generateQuestion();
}
else
{
Console.WriteLine("No. Please try again");
}
Console.ReadLine();
}
static int generateQuestion()
{
Random random = new Random();
int one = random.Next(1, 10);
int two = random.Next(1, 10);
int answer = one * two;
Console.Write("How much is " + one + " times " + two + "? ");
return answer;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment