If the lengths of the sides of a triangle are denoted by a, b, and c, then area of triangle is given by
area = squareroot(S*(s-a)*(s-b)*(s-c))
where, S = ( a + b + c ) / 2
#include math.h (include 2 arrows)
void main()
{
float areat(float,float,float);
float x,y,z,t;
printf("\nInput the three sides of the triangle");
scanf("%f%f%f",&x,&y,&z);
t=areat(x,y,z);
printf("\nThe area of the triangle is %f",t);
}
float areat(float a,float b,float c)
{
float s,area;
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
return(area);
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment