5.1 Draw a regular polygon

Scratch solution

View solution

This is just one of many possible solutions:

when green flag clicked
clear
go to x: (0) y: (0)
say [I'll draw a polygon with the number of sides you give me.] for (3) secs
ask [Enter the number of sides:] and wait
set [sides v] to (answer)
pen down
repeat (sides)
  move (50) steps
  turn cw ((360) / (sides)) degrees
end
pen up

Back to programming challenge

Extra Challenge

Extra challenge #1: Write a program that takes the length of a side of a polygon as the input, draws the polygon with the given side and displays its perimeter as the output.