Given two integers r and n where n is the number of sides of a regular polygon and r is the radius of the circle this polygon is circumscribed in. The task is to find the length of the side of polygon.
Input: n = 5, r = 11
Input: n = 3, r = 5
Approach: Consider the image above and let angle AOB be theta then theta = 360 / n.
In right angled triangle
So, AC = OA * sin(theta / 2) = r * sin(theta / 2)
Therefore, side of the polygon, AB = 2 * AC i.e. 2 * r * sin(theta / 2).
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.
- Polygon with maximum sides that can be inscribed in an N-sided regular polygon
- Area of a n-sided regular polygon with given side length
- Minimum side of square embedded in Regular polygon with N sides
- Area of a Circumscribed Circle of a Square
- Area of square Circumscribed by Circle
- Regular polygon using only 1s in a binary numbered circle
- Area of largest Circle inscribe in N-sided Regular polygon
- Minimum volume of cone that can be circumscribed about a sphere of radius R
- Maximum area of a Rectangle that can be circumscribed about a given Rectangle of size LxW
- Check if given polygon is a convex polygon or not
- Number of triangles formed by joining vertices of n-sided polygon with one side common
- Area of Triangle using Side-Angle-Side (length of two sides and the included angle)
- Program to find the Interior and Exterior Angle of a Regular Polygon
- Program to find the Circumcircle of any regular polygon
- Program to find the Perimeter of a Regular Polygon
- Program to find Area of Triangle inscribed in N-sided Regular Polygon
- Area of a n-sided regular polygon with given Radius
- Length of Diagonal of a n-sided regular polygon
- Apothem of a n-sided regular polygon
- Determine the position of the third person on regular N sided polygon
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.