#include <stdio.h>
#include <math.h>
double sanpen(double a, double b, double c) {
double s = (a + b + c) / 2;
double area
= sqrt(s
* (s
- a
) * (s
- b
) * (s
- c
)); return area;
}
int main() {
double a, b, c;
printf("Enter the lengths of the three sides of the triangle (a, b, c): "); scanf("%lf %lf %lf", &a
, &b
, &c
);
if (a + b > c && a + c > b && b + c > a) {
double area = sanpen(a, b, c);
printf("The area of the triangle is: %.2f\n", area
); } else {
printf("The given sides do not form a valid triangle.\n"); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXRoLmg+Cgpkb3VibGUgc2FucGVuKGRvdWJsZSBhLCBkb3VibGUgYiwgZG91YmxlIGMpIHsKICAgIGRvdWJsZSBzID0gKGEgKyBiICsgYykgLyAyOwogICAgZG91YmxlIGFyZWEgPSBzcXJ0KHMgKiAocyAtIGEpICogKHMgLSBiKSAqIChzIC0gYykpOwogICAgcmV0dXJuIGFyZWE7Cn0KCmludCBtYWluKCkgewogICAgZG91YmxlIGEsIGIsIGM7CgogICAgcHJpbnRmKCJFbnRlciB0aGUgbGVuZ3RocyBvZiB0aGUgdGhyZWUgc2lkZXMgb2YgdGhlIHRyaWFuZ2xlIChhLCBiLCBjKTogIik7CiAgICBzY2FuZigiJWxmICVsZiAlbGYiLCAmYSwgJmIsICZjKTsKCiAgICBpZiAoYSArIGIgPiBjICYmIGEgKyBjID4gYiAmJiBiICsgYyA+IGEpIHsKICAgICAgICBkb3VibGUgYXJlYSA9IHNhbnBlbihhLCBiLCBjKTsKICAgICAgICBwcmludGYoIlRoZSBhcmVhIG9mIHRoZSB0cmlhbmdsZSBpczogJS4yZlxuIiwgYXJlYSk7CiAgICB9IGVsc2UgewogICAgICAgIHByaW50ZigiVGhlIGdpdmVuIHNpZGVzIGRvIG5vdCBmb3JtIGEgdmFsaWQgdHJpYW5nbGUuXG4iKTsKICAgIH0KCiAgICByZXR1cm4gMDsKfQo=