Forked from tolmicl/gist:23104cbb24a4ad391f8553a2d77710b1
Created
January 21, 2017 06:06
-
-
Save cwake/8b08bbe014ff8e84c8aacdcceca7524d to your computer and use it in GitHub Desktop.
Computer-Assisted Instruction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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