Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Variables [5/14]

A call of the function rn produces a random whole number in the range from 1 to the value given by the argument.

In the first statement of the program, the function rn is called with an argument 10.

A function call is similar to a procedure call, except that a function call produces a value. In this program, function rn is called two times. The function rn accepts one argument.

A function call can be easily recognized by parenthesis () that must follow the function name. Arguments of a function call are listed inside parenthesis.

Exercise

1. Modify the program such that a third random number in the range from 1 to 33 also gets printed out.

Loading...