text: Side of a regular n | C ++ implementation of the approach ; Function to calculate the side of the polygon circumscribed in a circle ; Driver Code ; Total sides of the polygon ; Radius of the circumscribing circle
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; float calculateSide ( float n , float r ) { float theta , theta_in_radians ; theta = 360 / n ; theta_in_radians = theta * 3.14 / 180 ; return 2 * r * sin ( theta_in_radians / 2 ) ; } int main ( ) { float n = 3 ; float r = 5 ; cout << calculateSide ( n , r ) ; }