Problem 50
Dice Doubles
Modify your dice game from last time so that it keeps rolling until they get doubles (the same number on both dice).
Notice that since there’s no user input, this will happen very quickly (all the rolls will happen one right after the other).
HERE COMES THE DICE! Roll #1: 3 Roll #2: 5 The total is 8! Roll #1: 6 Roll #2: 1 The total is 7! Roll #1: 2 Roll #2: 5 The total is 7! Roll #1: 1 Roll #2: 1 The total is 2!
◄ 49: Keep Guessing 51: Counting with a While Loop ►
Adapted from ProgrammingByDoing.com
©2013 Graham Mitchell
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.