Dice challenge from the video[help]

Updated on October 30, 2017 in [A] Brackeys Courses
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
2 on October 29, 2017

I’m just new into programming and I want to make the dice app challenge but using for loop instead of while
it works almost fine but when it gets 6 it counts the attempt but doesn’t show the 6 can I do something about it

Here is my code :

        static void Main(string[] args)
        {
            Random nrgen = new Random();
            int nrofattempts = 1;
            int attempt = 0;
            for (attempt = 0; attempt != 6; attempt = nrgen.Next(1, 7))
            {
                Console.WriteLine(“Attempt hit  ” + attempt);
                nrofattempts++;
            }
            Console.WriteLine(“It took  ” + nrofattempts + ” attempts to hit 6″);
            Console.ReadKey();
        }
and here is image if you don’t understand what I mean 

https://imgur.com/a/LNsM7

  • Liked by
Reply