Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

BRACKEYS - Solution to C# Tutorial 04 Challenge

13»

Comments

  • My Solution To Challeng4:

    using System;


    namespace yeet_le_program

    {

        class Challenge4

        {

            static void Main(string[] args)

            {

                Random numberGen = new Random();

               

                int roll1 = 0;

                int roll2 = 1;

                int attempts = 0;


                Console.WriteLine("Press Enter to roll the dice");


                while(roll1 != roll2)

                {

                    Console.ReadKey();

                    roll1 = numberGen.Next(1,7);

                    roll2 = numberGen.Next(1,7);

                    Console.WriteLine("You Rolled: "+roll1+","+roll2);

                    attempts++;

                   

                   

                }

               

                Console.WriteLine("It took you "+attempts+" attempts to roll 2 of the same kind");

                Console.ReadKey();

            }

        }

    }

Sign In or Register to comment.