- 1
Write a program to store base and hight to triangle than print area
3 Réponses
+ 3
Please show us your attempt so far so we may help. Thanks.
Here are some hints:
To get the input;
int var;
cin >> var;
Formula for area of a triangle:
(base * height) / 2
+ 1
Area = 0.5*base*height
0
Hello
To calculate area of triangle equation is 05*height*base
To get Height and base from user refer following code:
cout<<"Enter height: ";
cin>>height;
cout<<"Enter base: ";
cin>>base;
area= (0.5)*height*base;
to print area use:
cout<<"Area of triangle is : "<<area;