While loops Flashcards
1
Q
A program has been written to obtain 3 random virtual dice rolls: DiceRoll(1) = Random Number 1-6 DiceRoll(2) = Random Number 1-6 DiceRoll(3) = Random Number 1-6 DISPLAY DiceRoll(1) DISPLAY DiceRoll(2) DISPLAY DiceRoll(3) Rewrite this algorithm in pseudocode so that it makes use of iteration.
A
counter = 3 WHILE counter !=0: dice_number = Random Number 1-6 OUTPUT dice_number counter = counter - 1