Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- double length;
- double width;
- double areaofrectangle;
- double perimeterofrectangle;
- cout<<"enter the length of rectangle"<<endl;
- cin>>length;
- cout<<"enter the width of rectangle"<<endl;
- cin>>width;
- areaofrectangle = length*width;
- perimeterofrectangle = 2*areaofrectangle;
- if(length==width)
- {
- cout<<"Can't compute base because a rectangle can't have both sides equal"<<endl;
- }
- else {
- cout<<"the area of the rectangle is "<< areaofrectangle <<endl;
- cout<<" the perimeter of the rectangle is "<<perimeterofrectangle<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement