Heads Up! If you are ready to compare your programming to ours or are wanting to have a look at how we solved it, click 'View solution' below to view at least one way to write this program.
View solution
This is just one of many possible solutions:
when green flag clicked
clear
go to x: (0) y: (0)
point in direction (90 v)
set [pi v] to [3.1415]
set [radius v] to [100]
move (radius) steps
point in direction (0 v)
pen down
repeat (360)
move ((((radius) * (2)) * (pi)) / (360)) steps
turn ccw (1) degrees
end
pen up
Extra challenge #1:
Write a program that works for any radius.
That means that it takes a radius as the input then draws a circle with the given radius, and then displays the circumference as the output.
Extra challenge #2:
Write a program that takes a circumference as the input then draws a circle with the given circumference and then displays the radius as the output.
Extra challenge #3:
[This requires advanced maths, but is a good challenge for a student who is familiar with Pythagoras' theorem] Draw a Circle Using Pythagoras’ Theorem.
The diagram above shows a circle (radius 100) drawn using the Pythagoras’ Theorem method.
(Note: The red triangle inside the circle is only to show the calculation and does not need to be drawn).
You can use Pythagoras’ Theorem (in any right-angle triangle, the square of the side opposite the right angle is equal to the sum of the squares of the other two sides so here ) to draw a circle.
We can do this by rearranging the formula to solve for like this:
We then calculate using a range of values for (i.e. from 0 to ). Your programming language will probably only give you the positive square root, so you will also need to plot the negative of .
This definition is not available in English, sorry!