Maximum of smallest possible area that can get with exactly k cut of given rectangular | Utility Function ; For the 1 st case ; For the second case ; Print final result ; Driver Code
function max_area ( n , m , k ) { if ( k > ( n + m - 2 ) ) document . write ( " " ) ; else { let result ; if ( k < Math . max ( m , n ) - 1 ) { result = Math . max ( m * ( n / ( k + 1 ) ) , n * ( m / ( k + 1 ) ) ) ; } else { result = Math . max ( m / ( k - n + 2 ) , n / ( k - m + 2 ) ) ; } document . write ( result ) ; } } let n = 3 , m = 4 , k = 1 ; max_area ( n , m , k ) ;