2.Write a program to find area of triangle using formula a = h*b*0.5.
where,
a - area of triangle
h - height of triangle and
b - length of base of triangle
#include<stdio.h>
#include<conio.h>
int main()
{
float b,h,area;
printf("\t\tProgram to find area of the triangle");
printf("\n---------------------------------------");
printf("\n\nenter length of base of triangle : ");
scanf("%f",&b);
printf("\nenter height of the triangle : ");
scanf("%f",&h);
area = 0.5*b*h;
printf("\nArea of the triangle is %f",area);
getch();
return 0;
}
Sample output
Comments