Tuesday, 28 October 2014

Finding area of triangle given its three side


Finding area of triangle given its three side



/*WAP to find the area of a triangle given its three side*/

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()                                                                 
{
float p,q,r,a,s;
clrscr();
printf("enter the three sides:");
scanf("%f%f%f",&p,&q,&r);
s=(p+q+r)/2.0;
a=sqrt(s*(s-p)*(s-q)*(s-r));
printf("area of the triangle is %.2f",a);
getch();
}

OUTPUT:
enter the three sides:3 4 5

area of the triangle is 6.00

No comments:

Post a Comment