Programming for Kids - ZedLX

The Easiest Way to Learn Computer Programming, for Free

Count and Sum [8/8]

This program rolls the dice 15 times and counts how many times it got a 6.

Exercise:

Modify the program so that it rolls two dice 15 times. It should count how many times it got doubles.

Solution

	...
	#num dice1 = rn(6);
	#num dice2 = rn(6);
	println "Dice roll: ", dice1," ",dice2;
	if dice1=dice2
	...
			
Loading...