Given a regular polygon of N sides with side length a. The task is to find the area of the polygon.
Input : N = 6, a = 9 Output : 210.444 Input : N = 7, a = 8 Output : 232.571
Approach: In the figure above, we see the polygon can be divided into N equal triangles. Looking into one of the triangles, we see that the whole angle at the center can be divided into = 360/N
So, angle t = 180/n
Now, tan(t) = a/2*h
So, h = a/(2*tan(t))
Area of each triangle = (base * height)/2 = a * a/(4*tan(t))
So, area of the polygon,
A = n * (area of one triangle) = a2 * n/(4tan t)
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.
- Side of a regular n-sided polygon circumscribed in a circle
- Minimum side of square embedded in Regular polygon with N sides
- Area of a n-sided regular polygon with given Radius
- Area of largest Circle inscribe in N-sided Regular polygon
- Program to find Area of Triangle inscribed in N-sided Regular Polygon
- Length of Diagonal of a n-sided regular polygon
- Area of Triangle using Side-Angle-Side (length of two sides and the included angle)
- Apothem of a n-sided regular polygon
- Regular polygon using only 1s in a binary numbered circle
- Check whether two convex regular polygon have same center or not
- Central angle of a N sided Regular Polygon
- Program to find the Perimeter of a Regular Polygon
- Angle between 3 given vertices in a n-sided regular polygon
- Program to find the Circumcircle of any regular polygon
- Determine the position of the third person on regular N sided polygon
- Program to find the Interior and Exterior Angle of a Regular Polygon
- Find the angle of Rotational Symmetry of an N-sided regular polygon
- Number of triangles formed by joining vertices of n-sided polygon with one side common
- Number of occurrences of a given angle formed using 3 vertices of a n-sided regular polygon
- Minimum area of a Polygon with three points given
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.