Find area of triangle in C++ by R4R Team

Area of triangle:
a=(h*b)/2
-Here h and b are the height and base of the triangle respectively.

program:

#include< iostream>
class r4r
{
public:
int find_area(int height, int base)
{
int area;
area=(height*base)/2;
cout<<"Area of triangle is "<< area;
}
};
int main() {
int height,base;
r4r obj;
cout<<"Enter height of triangle"<< endl;
cin>>height;
cout<<"Enter base"<< endl;
cin>>base;
obj.find_area(height,base);
}


output-

Enter height of triangle
10
Enter base
9
Area of triangle is 45.000000




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!