Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Variables [6/14]

This program prints 12 random numbers in the range from 1 to 10.
[Run the program]

Exercise:

(Very challenging!) Modify this program so that it prints out 16 random numbers in the range from 100 to 110.

Solution

for #i=1..16
	{
	#num x = rn(11)+99;
	println x;
	sleepMs(300);
	}

Almost no beginner can solve this exercise correctly. The point of the exercise is:

  • to make the reader remember how this task is accomplished
  • to make the reader aware that learning programming is not easy, even when it seems easy

Some things seem easy, but they are not. Some things are easy only after the solution is known.

Loading...