Write a program in C++ to print the area and perimeter of a rectangle
- برمجة سي بلس بلس
- برمجة
- 2021-05-11
- MarwaMohammed
الأجوبة
#include <iostream>
using namespace std;
int main()
{
float ar,peri,width,height=0;
cout << "\n\n Print the area and perimeter of a rectangle:\n";
cout << "----------------------------------------------\n";
cout << " Input the width of the rectangle: ";
cin>> width;
cout << " Input the height of the rectangle: ";
cin>> height;
peri=2 * (width+height);
ar= height * width;
cout<<"The area of the rectangle is: "<<ar<<"\n";
cout<<"The perimeter of the rectangle is: "<<peri<<"\n";
}
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
