Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Simple Graphics [5/15]

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

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

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

Exercise 1:

Exercise Iteration mid-disc 1 output image

Draw a yellow disc in the middle of red discs. The yellow disc should touch all 4 red discs.

Solution

Append the following 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...