Ratio of area of two nested polygons formed by connecting midpoints of sides of a regular N | C ++ code for the above approach ; Function to calculate the ratio of area of N - th and ( N + 1 ) - th nested polygons formed by connecting midpoints ; Stores the value of PI ; Calculating area the factor ; Printing the ratio precise upto 6 decimal places ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void AreaFactor ( int n ) { double pi = 3.14159265 ; double areaf = 1 / ( cos ( pi / n ) * cos ( pi / n ) ) ; cout << fixed << setprecision ( 6 ) << areaf << endl ; } int main ( ) { int n = 4 ; AreaFactor ( n ) ; return 0 ; }