Minimum area of square holding two identical rectangles | C ++ program for the above problem ; Function to find the area of the square ; Larger side of rectangle ; Smaller side of the rectangle ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int areaSquare ( int L , int B ) { int large = max ( L , B ) ; int small = min ( L , B ) ; if ( large >= 2 * small ) return large * large ; else return ( 2 * small ) * ( 2 * small ) ; } int main ( ) { int L = 7 ; int B = 4 ; cout << areaSquare ( L , B ) ; return 0 ; }