In: Computer Science
program:
#include <iostream>
using namespace std;
int main()
{
int l1,l2,w1,w2;
int area1,area2;
//Enter length and width of rectangle1
cout<<"Enter length of rectangle1:";
cin>>l1;
cout<<"Enter width of rectangle1:";
cin>>w1;
//Enter length and wisth of ractanle2
cout<<"Enter length of rectangle2:";
cin>>l2;
cout<<"Enter width of rectangle2:";
cin>>w2;
if(w1>w2) //if width of ractangle1 is greater than width of
rectangle2
{
area1=l1*w1; //then calculate area of rectangle1
cout<<"Area of rectangle1 is:"<<area1;
}
else //if width of reactangle2 is greater than width of
reactangle1
{
area2=l2*w2; //then calculate area of rectangle2
cout<<"Area of Rectangle2 is:"<<area2;
}
return 0;
}
output: