Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

The if Statement [12/16]

This program draws 150 discs. The discs in the upper third and bottom third of the screen are painted in red, and the ones in the middle are in blue.

Exercise:

Exercise if statement 12-1 output image

Modify this program such that only the discs with a radius smaller then 40 or radius greater than 85 are painted in red, and other ones in blue.

Solution

	if radius<40 or radius>85
		: mycolor = /red;

Loading...