求三角形面积
Time Limit: 1000MS
Memory Limit: 65536KB
Problem Description
已知三角形的边长a、b和c,求其面积。
Input
输入三边a、b、c。
Output
输出面积,保留3位小数。
Example Input
1 2 2.5
Example Output
0.950
#include<stdio.h>
#include<math.h>
int main()
{
double a,b,c,d,s;
scanf("%lf %lf %lf",&a,&b,&c);
d=0.5*(a+b+c);
s=sqrt(d*(d-a)*(d-b)*(d-c));
printf("%.3lf\n",s);
return 0;
}