Sum of Polygon Angles

Published by Werdna in

Given an n-sided regular polygon n, return the total sum of internal angles (in degrees).

Examples

SumPolygon(3) ➞ 180

SumPolygon(4) ➞ 360

SumPolygon(6) ➞ 720

Notes

  • n will always be greater than 2.
  • The formula (n - 2) x 180 gives the sum of all the measures of the angles of an n-sided polygon.
Watch a quick demo on how Edabit works.