Draw a star with any odd number of points

Challenge Level: Ready to expand

Learning outcomes

Students will be able to:


Write a program that draws a star with any given odd number of points entered by the user as the input with the length of each edge equal to 200 steps.

Testing examples:

Your program should display the outputs shown in this table for the given inputs provided;

Inputs Output
13 A 13 pointed star.

55 A 55 pointed star.



What it should look like

Click on the green flag to see the expected output of your program.

Recommended blocks
when green flag clicked

pen down

pen up
ask [Enter an odd number of points to draw a star:] and wait

repeat (points)

set [points v] to (answer)
go to x: (0) y: (0)

move (200) steps

turn cw ((180) - ((180) / (points))) degrees
  • You need an odd number of points to be able to draw a star.
  • Each inside angles of a star with any odd number of points is 180 degrees/number of points.

Show Scratch solution