0
How to find area of triangle in turbo c?
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;
}
0
Why do we right 3f?
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