Find the number of rectangles of size 2 * 1 which can be placed inside a rectangle of size n * m | Function to Find the number of rectangles of size 2 * 1 can be placed inside a rectangle of size n * m ; If n is even ; If m is even ; If both are odd ; Driver Code ; Function call
function NumberOfRectangles ( n , m ) { if ( n % 2 == 0 ) return ( n / 2 ) * m ; else if ( m % 2 == 0 ) return ( m / 2 ) * n ; return ( n * m - 1 ) / 2 ; } var n = 3 , m = 3 ; document . write ( NumberOfRectangles ( n , m ) ) ;