Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Count and Sum [8/8]

This program calculates the sum of 9 random numbers.

After running and examining the program, modify it so that it sums up only those numbers that are smaller than 10. To accomplish that, use an if statement.


	if x<10
	    sum += x;
	    println " Sum so far: ", sum;