A simple program to simulate a die to get a desired number in row. How can I better my code?

Hi

I wrote a program to simulate a die. The program counts how many times the die needs to be rolled to obtain 3 consecutive sixes. However it's pretty long and contains nested loops and many variables. Is there any simpler way to achieve my objective? How might I make this code more simple so that it's easy to understand (in it's current form it's difficult to follow the flow of commands  :(  )

Here's my code:

/* A program for checking how many times a 'fair' die needs to be rolled to...

Read More »

By: coderanchjavarecent - Tuesday, 13 March

Related Posts