[자유]Hj
11.17(월)조회 304추천수 0댓글수 0
nternal class Program
{
static int[] DrawDice()
{
Random rnd = new Random();
int[] diceAry = new int[3];
for (int i = 0; i < diceAry.Length; i++)
diceAry[i] = rnd.Next(1, 6);
return diceAry;
int[] ary;
ary = DrawDice();
}
static void Main(string[] args)
{
int[] ary;
int count = 0;
while (true)
{
count++;
ary = DrawDice();
Console.Write("{0}회 던졌음 ==> ", count);
for (int i = 0; i < ary.Length; i++)
{
Console.Write(ary[i] + " ");
}
Console.WriteLine();
Console.Write("계속 진행하시려면 엔터키를 입력하세요.");
Console.ReadLine();
if (ary[0] == ary[1] && ary[1] == ary[2])
{
Console.WriteLine("3개의 숫자가 맞았습니다.종료합니다.");
break;
}
}
}
}



총 0개의 댓글이 있습니다.