9.已知三边计算三角形的面积公式

 1 #include <stdio.h>
 2 #include <stdlib.h>
 3 #include <math.h>
 4 
 5 int main()
 6 {
 7     float  a,b,c,s,area;
 8     scanf("%f%f%f",&a,&b,&c);
 9     s = (a+b+c)/2;                //已知三边计算三角形面积公式
10     area = sqrt(s*(s-a)*(s-b)*(s-c));  
11     printf("%f",area);
12     return 0;
13 }

猜你喜欢

转载自www.cnblogs.com/spore/p/10256821.html