Polygon with maximum sides that can be inscribed in an N | Function to find the maximum sided polygon that can be inscribed ; Base Case ; Return n / 2 if n is even Otherwise , return - 1 ; Given N ; Function Call
function MaximumSides ( n ) { if ( n < 4 ) return - 1 ; return n % 2 == 0 ? n / 2 : - 1 ; } let N = 8 ; document . write ( MaximumSides ( N ) ) ;