#include "stdio.h"
#include "math.h"
int main()
{
int a,b,c;
float p,s;
while (1)
{
printf("请输入三边长:");
scanf_s("%d,%d,%d", &a,&b,&c);
if (a + b > c && a + c > b && b + c > a)
{
p = (a + b + c) / 2.0;
s = sqrt(p * (p - a) * (p - b) * (p - c));
printf("面积为%f\n",s);
}
else
printf("您输入的边长不合理,请重新输入\n");
}
}
运行结果