#include <stdio.h>
#include <math.h>
typedef struct {
double a;
double b;
double c;
} Triangle;
double calculateArea(Triangle t) {
double s = (t.a + t.b + t.c) / 2;
return sqrt(s
* (s
- t.
a) * (s
- t.
b) * (s
- t.
c)); }
int main(void) {
Triangle t;
printf("a:%lf,b:%lf,c:%lf\n",t.
a,t.
b,t.
c);
if (t.a + t.b > t.c && t.b + t.c > t.a && t.c + t.a > t.b) {
double area = calculateArea(t);
printf("三角形の面積: %lf\n", area
); } else {
printf("入力された値では三角形を形成できません。\n"); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXRoLmg+Cgp0eXBlZGVmIHN0cnVjdCB7CiAgICBkb3VibGUgYTsKICAgIGRvdWJsZSBiOwogICAgZG91YmxlIGM7Cn0gVHJpYW5nbGU7Cgpkb3VibGUgY2FsY3VsYXRlQXJlYShUcmlhbmdsZSB0KSB7CiAgICBkb3VibGUgcyA9ICh0LmEgKyB0LmIgKyB0LmMpIC8gMjsKICAgIHJldHVybiBzcXJ0KHMgKiAocyAtIHQuYSkgKiAocyAtIHQuYikgKiAocyAtIHQuYykpOwp9CgppbnQgbWFpbih2b2lkKSB7CiAgICBUcmlhbmdsZSB0OwogICAgCiAgICBzY2FuZigiJWxmIiwgJnQuYSk7CiAgICBzY2FuZigiJWxmIiwgJnQuYik7CiAgICBzY2FuZigiJWxmIiwgJnQuYyk7CiAgICBwcmludGYoImE6JWxmLGI6JWxmLGM6JWxmXG4iLHQuYSx0LmIsdC5jKTsKICAgIAogICAgaWYgKHQuYSArIHQuYiA+IHQuYyAmJiB0LmIgKyB0LmMgPiB0LmEgJiYgdC5jICsgdC5hID4gdC5iKSB7CiAgICAgICAgZG91YmxlIGFyZWEgPSBjYWxjdWxhdGVBcmVhKHQpOwogICAgICAgIHByaW50Zigi5LiJ6KeS5b2i44Gu6Z2i56mNOiAlbGZcbiIsIGFyZWEpOwogICAgfSBlbHNlIHsKICAgICAgICBwcmludGYoIuWFpeWKm+OBleOCjOOBn+WApOOBp+OBr+S4ieinkuW9ouOCkuW9ouaIkOOBp+OBjeOBvuOBm+OCk+OAglxuIik7CiAgICB9CiAgICByZXR1cm4gMDsKfQ==