Find area of triangle in C by R4R Team

Area of triangle:

a=(h*b)/2

-Here h and b are the height and base of the triangle respectively.

program-

#include< stdio.h>
int main() {
int height,base;
float area;
printf("Enter height of triangle\n");
scanf("%d",&height);
printf("Enter base\n");
scanf("%d",&base);
area=(height*base)/2;
printf("Area of triangle is %f",area);
}


output-

Enter height of triangle
10
Enter base
9
Area of triangle is 45.000000

-In this program, we take an input in the variable height and variable base.
-Then apply formula for area of triangle and store that value in variable 'area'.
-And at last display that area.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!