Rectangle: It is a quadrilateral which has four right (90 degree) angle triangle.
Area of the rectangle: $height \times width$
Perimeter of the rectangle : $ 2 \times (height + width) $
Algorithm:
- Start
- Enter the height and width of the rectangle
- Area = $height \times width$
- Circumference = $ 2 \times (height + width) $
- Stop
#include "iostream"
using namespace std;
int main()
{
int width,height,area,perimeter;
cout<<"Enter width of rectangle : ";
cin >> width;
cout<< "Enter height of rectangle : ";
cin >> height;
area = height * width;
cout<<"Area of rectangle : "<<area<<endl;
perimeter=2*(height+width);
cout<< "Perimeter of rectangle : "<<perimeter<<endl;
return (0);
}
INPUT : Enter the width of rectangle: 12
Enter the height of rectangle: 10
OUTPUT : Area of the rectangle: 120
Perimeter of the rectangle: 44

No comments:
Post a Comment