Skip to content

Instantly share code, notes, and snippets.

@kureikei
Created July 22, 2018 06:09
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
class Program
{
static void Main(string[] args)
{
var r = new Random();
for (int i = 0; i < 10; i++)
{
var a = r.Next(1, 10);
var b = r.Next(1, 10);
Console.Write($"{a} + {b} = ");
Console.WriteLine(int.TryParse(Console.ReadLine(), out var input) && input == a + b ?
"正解!" :
$"不正解!答え: {a + b}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment