Find area of rectangle in C++ by R4R Team

Area of rectangle:
area=l*b;
-Here,
l is length of rectangle
and b is breath of rectangle

program:

#include< iostream>
class r4r
{
public:
int find_area(int length, int breath)
{
int area;
area=breath*length;
cout<<"Area of rectangle is "<< area;
}
}
int main() {
int l,b;
r4r obj;
cout<<"Enter Length of rectangle"<< endl;
cin>>l;
cout<<"Enter breath of rectangle"<< endl;
cin>>b;
obj.find_area(l,b);
}


output-

Enter length of rectangle
10
Enter breath of rectangle
3
Area is 30

-In this program, we take an input in the variable height and breath.
-Then apply formula for area of rectangle and store that value in variable 'area'.
-And at last display that area.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!