/* 输入三角形的三边长,求三角形面积 */
#include <stdio.h>
#include <math.h>
int main()
{
float a, b, c, s, area;
scanf_s("%f %f %f", &a, &b, &c);
s = 1.0 / 2 * (a + b + c);
area = sqrt(s * (s - a) * (s - b) * (s - c));
printf("a = %7.2f, b = %7.2f, c = %7.2f, s = %7.2f\n", a, b, c, s);
printf("area = %7.2f\n\n", area);
return 0;
}
第四章 例4.10
最新推荐文章于 2022-12-19 09:21:14 发布