Program to find the Circumcircle of any regular polygon | C ++ Program to find the radius of the circumcircle of the given polygon ; Function to find the radius of the circumcircle ; these cannot be negative ; Radius of the circumcircle ; Return the radius ; Driver code ; Find the radius of the circumcircle
#include <bits/stdc++.h> NEW_LINE using namespace std ; float findRadiusOfcircumcircle ( float n , float a ) { if ( n < 0 a < 0 ) return -1 ; float radius = a / sqrt ( 2 - ( 2 * cos ( 360 / n ) ) ) ; return radius ; } int main ( ) { float n = 5 , a = 6 ; cout << findRadiusOfcircumcircle ( n , a ) << endl ; return 0 ; }