Ratio of area of two nested polygons formed by connecting midpoints of sides of a regular N | 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
function AreaFactor ( n ) { let pi = 3.14159265 ; let areaf = ( 1 / ( Math . cos ( pi / n ) * Math . cos ( pi / n ) ) ) ; document . write ( areaf . toFixed ( 6 ) ) ; } let n = 4 ; AreaFactor ( n ) ;