- Share this text:
Report Abuse
Untitled - posted by guest on 14th August 2020 07:28:18 AM
using System;
public class Roll
{
static public void Main ()
{
Random numGen1 = new Random();
Random numGen2 = new Random();
int roll1 = 0;
int roll2 = 0;
int attempts = 0;
Console.WriteLine("Press any keys except esc to roll");
while (roll1 != roll2)
{
Console.ReadKey();
roll1 = numGen1.Next(1,7);
roll2 = numGen2.Next(1,7);
Console.WriteLine("Roll 1: " + roll1 + "/nRoll2: " + roll2);
attempts++;
}
Console.WriteLine("It tooks " + attempts + "attempts");
Console.ReadKey();
}
}