Given an integer N representing N sided regular polygon, the task is to find the angle made by the sides on the centre of the polygon that is the central angle.
The central angle is the angle formed by the two vertices forming an edge and the centre.
Input: N = 6
The polygon is a hexagon with an angle 60 degree.
Input: N = 5
The polygon is a pentagon with an angle 72 degree.
Approach: The idea is to observe that since there is a regular polygon all the central angles formed will be equal.
All central angles would add up to 360 degrees (a full circle), so the measure of the central angle is 360 divided by the number of sides.
Hence, central angle = 360 / N degrees, where N is the number of sides.
Below is the implementation of the above approach:
Time Complexity: O(1)
Auxiliary Space: O(1)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.