Given here the side length a of a regular n-sided polygon, the task is to find the length of its Apothem.
Apothem is the line drawn from the center of the polygon that is perpendicular to one of its sides.
Input a = 9, n = 6 Output: 7.79424 Input: a = 8, n = 7 Output: 8.30609
In the figure, we see the polygon can be divided into n equal triangles.
Looking into one of the triangles, we see the whole angle at the centre can be divided into = 360/n
So, angle t = 180/n
now, tan t = a/2h
So, h = a/(2*tan t)
here, h is the apothem,
so, apothem = a/(2*tan(180/n))
Below is the implementation of the above approach.
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.
- Program to find the Circumcircle of any regular polygon
- Program to find the Perimeter of a Regular Polygon
- Length of Diagonal of a n-sided regular polygon
- Area of a n-sided regular polygon with given Radius
- Angle between 3 given vertices in a n-sided regular polygon
- Central angle of a N sided Regular Polygon
- Check whether two convex regular polygon have same center or not
- Regular polygon using only 1s in a binary numbered circle
- Side of a regular n-sided polygon circumscribed in a circle
- Determine the position of the third person on regular N sided polygon
- Area of a n-sided regular polygon with given side length
- Find the angle of Rotational Symmetry of an N-sided regular polygon
- Program to find the Interior and Exterior Angle of a Regular Polygon
- Area of largest Circle inscribe in N-sided Regular polygon
- Minimum side of square embedded in Regular polygon with N sides
- Number of occurrences of a given angle formed using 3 vertices of a n-sided regular polygon
- Program to find Area of Triangle inscribed in N-sided Regular Polygon
- Sum of internal angles of a Polygon
- Minimum area of a Polygon with three points given
- Check if it is possible to create a polygon with given n sides
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.