#include <stdio.h>#include <math.h>int main(){float a,b,c,p,s;scanf("%f%f%f",&a,&b,&c);if(a>=b+c||b>=a+c||c>=a+b)printf("不能构成三角形!\n");else{p=(a+b+c)/2;s=sqrt(p*(p-a)*(p-b)*(p-c)); printf("s=%g\n",s);}return 0;}
#include <stdio.h>#include <math.h>int main(){ float a, b, c, p, s; scanf("%f%f%f", &a, &b, &c); p = 0.5 * (a + b + c); s = sqrt(p * (p-a) * (p-b) * (p-c)); printf("area = %f\n", s); return 0;}