You will write a program that throws a die until the 6 appears for the second time.
You simply count the 6s.
If there are two 6x, exit the while loop
using System; class Program//from w w w .j a v a 2s .c o m { static void Main(string[] args) { // Random number generator Random randomNumbers = new Random(); // Throwing until the second six is thrown int howManySixes = 0; do { // Actual throwing int thrown = randomNumbers.Next(1, 6 + 1); Console.WriteLine(thrown); // Counting sixes if (thrown == 6) { howManySixes++; } } while (howManySixes < 2); } }