Ratio of area of two nested polygons formed by connecting midpoints of sides of a regular N | Java program 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
import java . io . * ; class GFG { static void AreaFactor ( int n ) { double pi = 3.14159265 ; double areaf = 1 / ( Math . cos ( pi / n ) * Math . cos ( pi / n ) ) ; System . out . format ( " % .6f " , areaf ) ; } public static void main ( String [ ] args ) { int n = 4 ; AreaFactor ( n ) ; } }