Uppgift 3

using System;
using System.Collections.Generic;
using System.Text;

namespace Project1
{
class Class1
{
public static void Main(String[] arg)
{
for (int i = 0; true; i++)
{
Random r = new Random();
int rand1 = r.Next(6) + 1;
int rand2 = r.Next(6) + 1;

Console.WriteLine("Kast nummer " + i + "\t" + rand1 + " + " + rand2 + " = " + (rand1 + rand2));

if (rand1 + rand2 == 12 || i > 100)
{
Console.WriteLine("Det behövdes " + i + " kast");
break;
}

System.Threading.Thread.Sleep(40);
}
}
}
}

Kommentarer

Kommentera inlägget här:

Namn:
Kom ihåg mig?

E-postadress: (publiceras ej)

URL/Bloggadress:

Kommentar:

Trackback
RSS 2.0