Monday, 7 January 2013

Hero’s Formula is A method for calculating the area of a triangle when you know the lengths of all three sides. Let a, b, c be the lengths of the sides of a triangle. The area is given by: where


#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
float a,b,c,p,A;
printf("enter a,b&c=");
scanf("%f%f%f",&a,&b,&c);
p=(a+b+c)/2;
A=sqrt(p*(p-a)*(p-b)*(p-c));
printf("p=%f\nA=%f",p,A);
getch();
}

No comments:

Post a Comment