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);
}
Enter height of triangle
10
Enter base
9
Area of triangle is 45.000000