发布网友 发布时间:2022-04-23 15:53
共1个回答
热心网友 时间:2023-07-16 08:45
代码资料:
#include "stdio.h"
#include "math.h"
int main(int argc,char *argv[]){
int a,b,c;
double s;
printf("Enter a, b, c(int,a,b,c>0)...\n");
if(scanf("%d%d%d",&a,&b,&c)!=3 || a<1 || b<1 || c<1){
printf("Input error, exit...\n");
return 0;
}
if(a+b>c && b+c>a && a+c>b){
s=(a+b+c)/2.0;
printf("The area is %.2g\n",sqrt(s*(s-a)*(s-b)*(s-c)));
}
else
printf("%d-%d-%d don't make a triangle...\n",a,b,c);
return 0;
}