Count of nested polygons that can be drawn by joining vertices internally | C # program for the above approach ; Function that counts the nested polygons inside another polygons ; Stores the count ; Child polygons can only existss if parent polygon has sides > 5 ; Get next nested polygon ; Return the count ; Driver Code ; Given side of polygon ; Function call
using System ; class GFG { static int countNestedPolygons ( int sides ) { int count = 0 ; while ( sides > 5 ) { sides /= 2 ; count += 1 ; } return count ; } public static void Main ( String [ ] args ) { int N = 12 ; Console . Write ( countNestedPolygons ( N ) ) ; } }