Home My space log
Language EN (English)

Inside angle of a shape

JavaScript Beginner robot ages 11-13 From CS Unplugged

The problem

In a regular shape all sides and angles are the same. Write a function insideAngle(sides) that gives back the size of each inside angle in degrees. The rule is (sides - 2) times 180, divided by sides. Example: a square (4 sides) has 90 degree angles.

You will practice: maths in code, functions, division

Mode

Press Tab to indent. Press Esc and then Tab to move on to the next button.

Your code runs in your browser. We do not receive it or save it.

Test results

      What your code printed

      
          

      CC BY-SA 4.0

      Adapted from a CS Unplugged programming challenge by the University of Canterbury Computer Science Education Research Group, licensed CC BY-SA 4.0.

      Original challenge · License: CC BY-SA 4.0

      Changes: Rewritten in our own words as a function with tests, hints and steps, in Python and JavaScript, by Open Cosmos. This version is also CC BY-SA 4.0.