Count of nested polygons that can be drawn by joining vertices internally | 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 ; Given side of polygon ; Function Call
function countNestedPolygons ( sides ) { var count = 0 ; while ( sides > 5 ) { sides /= 2 ; count += 1 ; } return count ; } var N = 12 ; document . write ( countNestedPolygons ( N ) ) ;