Formula of Area of Triangle:
Area = ( s (s-a) (s-b) (s-c) ) ^ (1/2)
where s = (a+b+c) / 2
a , b and c are the Sides of Triangle.
Statement of C Program: Write a Program to Find the Area of a Triange , given the Three Sides of Triangle:
Source Code
#include<stdio.h>
#include<math.h>
int main()
{
float a,b,c,s=0,area=0;
printf("Enter the length of sides of triangle \n");
scanf("%f %f %f",&a,&b,&c);
s = (a+b+c)/2.0; /* s is semi-perimeter */
area = (sqrt)(s*(s-a)*(s-b)*(s-c));
printf("Area of triangle =\t %f",area);
return 0;
}
Output
0 comments:
Post a Comment