0

How to find area of triangle in turbo c?

21st Aug 2016, 9:25 AM
Raj shah
Raj shah - avatar
3 Answers
+ 3
you may also do this: #include<stdio.h> #include<math.h> int main(){     float b,h;     float area;     printf("Enter base and height of triangle");     scanf("%f%f",&b,&h,);     area = (b*h)/2; printf("Area of triangle is: %.3f",area); return 0; }
21st Aug 2016, 7:06 PM
Erwin Mesias
Erwin Mesias - avatar
0
Why do we right 3f?
23rd Aug 2016, 2:38 PM
Raj shah
Raj shah - avatar
0
@Raj, we use %.3f so that the answer will be presented with 3 decimal places. for exampe: The computed area is 2.3. The answer will be presented as 2.300
23rd Aug 2016, 3:44 PM
Erwin Mesias
Erwin Mesias - avatar