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 , angle ACO = 90 degrees and angle AOC = theta / 2.
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.
- Area of a n-sided regular polygon with given side length
- Minimum side of square embedded in Regular polygon with N sides
- Regular polygon using only 1s in a binary numbered circle
- Area of largest Circle inscribe in N-sided Regular polygon
- Area of square Circumscribed by Circle
- Area of a Circumscribed Circle of a Square
- Apothem of a n-sided regular polygon
- Check whether two convex regular polygon have same center or not
- Area of a n-sided regular polygon with given Radius
- Program to find the Perimeter of a Regular Polygon
- Central angle of a N sided Regular Polygon
- Angle between 3 given vertices in a n-sided regular polygon
- Program to find the Circumcircle of any regular polygon
- Length of Diagonal of a n-sided regular polygon
- Determine the position of the third person on regular N sided polygon
- Find the angle of Rotational Symmetry of an N-sided regular polygon
- Program to find the Interior and Exterior Angle of a Regular Polygon
- Number of triangles formed by joining vertices of n-sided polygon with one side common
- Program to find Area of Triangle inscribed in N-sided Regular Polygon
- Number of occurrences of a given angle formed using 3 vertices of a n-sided regular polygon