solve using codeblocks Person A has a land of size areaA at priceA per square me
ID: 3889649 • Letter: S
Question
solve using codeblocks
Person A has a land of size areaA at priceA per square meter.
Person B has a land of size areaB at priceB per square meter
. Person A asked person B if he likes to exchange his land with person B land
. Write a program that Person B can use to read the two areas and the two prices and decide whether to exchange the lands or not. Sample input/output:
sample(1) -Enter The area and price of land A ; 3427 2750
-Enter the area and price of land B ; 1890 5128
-No, i dont like to exchange
sample(2) -Enter The area and price of land A ; 3427 2750
-Enter the area and price of land B ; 1890 3250
- yes, i like to exchange
Explanation / Answer
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d;
cout<<"-Enter The area and price of land A ;";
cin>>a>>b;
cout<<"-Enter the area and price of land B ;";
cin>>c>>d;
if(a*b<=c*d)
{
cout<<"-No, i dont like to exchange"<<endl;
}
else{
cout<<"-yes, i like to exchange"<<endl;
}
}
output;
-Enter The area and price of land A ; 3427 2750
-Enter the area and price of land B ; 1890 5128
-No, i dont like to exchange
--------------------------------------------------------------------
Enter The area and price of land A ; 3427 2750
-Enter the area and price of land B ; 1890 3250
- yes, i like to exchange
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.