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