#include<stdio.h>
#include<math.h>
void main()
{int a,b,c;
float x,s;
printf("请输入三个数\n");
scanf("%d,%d,%d",&a,&b,&c);
x=(1.0/2)*(a+b+c);
if(a+b>c&&a+c>b&&b+c>a)
{s=sqrt(x*(x-a)*(x-b)*(x-c));
printf("s=%f\n",s);}
else
printf("请重新输入\n");
}![](https://img-my.csdn.net/uploads/201211/07/1352290840_2468.jpg)
![](https://img-my.csdn.net/uploads/201211/07/1352290854_7596.jpg)
#include<math.h>
void main()
{int a,b,c;
float x,s;
printf("请输入三个数\n");
scanf("%d,%d,%d",&a,&b,&c);
x=(1.0/2)*(a+b+c);
if(a+b>c&&a+c>b&&b+c>a)
{s=sqrt(x*(x-a)*(x-b)*(x-c));
printf("s=%f\n",s);}
else
printf("请重新输入\n");
}
![](https://img-my.csdn.net/uploads/201211/07/1352290840_2468.jpg)
![](https://img-my.csdn.net/uploads/201211/07/1352290854_7596.jpg)
![](https://img-my.csdn.net/uploads/201211/07/1352290864_3026.jpg)