Printing AREA and PARAMETER of rectangle
Printing AREA and PARAMETER of rectangle by taking input from the user.
fig1.code
fig2. output
code of this program can be copied from the below:-
/*C++ PROGRAM FOR TAKING INPUT FROM THE USER AND GIVING BACK AREA AND PERIMETER OF RECTANGLE*/
#include <iostream> /* BASIC BUT IMPORTANT HEADER FILE*/
#include <stdio.h>
using namespace std; /* FOR STANDARD INPUT OUTPUT */
int main()
{
float ar,peri,width,height=0; /* DECLARING VARIABLES AND THEIR DATA TYPES*/
cout << "HELLO EVERYONE, in this program we are finding AREA of Rectangle and PERIMETER as well with the help of C++ lang. \n\n" ;
cout << "\n print the area of rectangle: \n";
cout << "-----------------------------------\n";
cout << "Input the width of the rectangle: \n";
cin >> width;
cout << "Input the height of the rectangle: \n";
cin >> height;
ar = height * width;
peri = 2 * (width + height);
cout << "the area of rectangle is : " <<ar<< " \n";
cout << "the perimeter of rectangle is : " << peri << "\n";
return 0 ;
}
dont forget to like share and subscribe to our YouTube Channel:-
Comments
Post a Comment