the are of a rectangle is the rectangle's length times its width. Write a program that asks for the length and width of two rectangles. the program should tell the user which rectangle has the greater area, or if the ares are the same.
1
Expert's answer
2011-10-27T08:18:03-0400
#include <iostream.h> #include <conio.h> main(){ float a1,b1,a2,b2,s1,s2; cout<<"Enter the lenght of the first rectangle:"; cin>>a1; cout<<"Enter the width of the first rectangle:"; cin>>b1; cout<<"Enter the lenght of the second rectangle:"; cin>>a2; cout<<"Enter the width of the second rectangle:"; cin>>b2; s1 = a1*b1; s2 = a2*b2; if (s1>s2) cout<<"First rectangle is larger than the second"; if (s1<s2) cout<<"Second rectangle is larger than the first"; if (s1==s2) cout<<"Rectangles has equal areas"; getch(); }
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment