Learn to Program with ZedLX

Free Online Programming Course for Beginners

Simple Graphics [5/15]

This program draws four red discs.
[Run the program]

The text after symbols << is a comment. Comments are ignored by the computer.

The disc statement accepts four arguments: disc(x, y, radius, color)

Exercise 1:

Exercise Iteration mid-disc 1 output image

Draw a yellow disc in the middle of the red discs. It should touch all four red discs.

Solution

Append this statement to the program:

disc(500, 400, 50, /yellow);

Exercise 2:

Exercise Iteration mid-disc 2 output image

Draw a green disc touching the rightmost red disc from the right side.

Solution

disc(700, 400, 50, /green);

Loading...