Skip to content

Instantly share code, notes, and snippets.

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