Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

while Loop and Keyboard [2/11]

This program prints the square of each natural number i while the square is smaller than 300.

The condition of the while loop is checked only at the beginning of each iteration.

After running the program, modify it so that it also outputs the value of variable i on each iteration.

After that, modify the program so that it outputs the first 123 squares of natural numbers. Since the program needs to output a long list, make the program run faster. To verify that the list is correct, check that the last number in the list ends with digits 129.

Solution

	while i <= 123 

Loading...