How to find area of triangle using function in C

#include<stdio.h>
#include<conio.h>
float areaoftri( int b,int h);
void main ()
{
int b,h;
float f;
clrscr();
printf(“Enter base and height “);
scanf(“%d%d”,&b,&h);
f=areaoftri(b,h);
printf(“%f”,f);
getch();
}
float areaoftri( int b,int h)
{
double area;
area=1/2.0*(b*h);
return area;
}

After Running Program 🙂

 

Leave a Reply