#include <stdio.h>
#include <math.h>
// 三角形の3辺を表す構造体
struct Triangle {
double a;
double b;
double c;
};
int main(void) {
struct Triangle triangle;
// ユーザーに3辺の長さを入力してもらう
scanf("%lf", &triangle.
a); scanf("%lf", &triangle.
b); scanf("%lf", &triangle.
c);
// ヘロンの公式による面積計算
double s = (triangle.a + triangle.b + triangle.c) / 2.0;
double area
= sqrt(s
* (s
- triangle.
a) * (s
- triangle.
b) * (s
- triangle.
c));
// 結果の出力
printf("\n三角形の辺: a = %.2lf, b = %.2lf, c = %.2lf\n", triangle.
a, triangle.
b, triangle.
c); printf("三角形の面積: %.2lf\n", area
);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXRoLmg+CgovLyDkuInop5LlvaLjga4z6L6644KS6KGo44GZ5qeL6YCg5L2TCnN0cnVjdCBUcmlhbmdsZSB7CiAgICBkb3VibGUgYTsKICAgIGRvdWJsZSBiOwogICAgZG91YmxlIGM7Cn07CgppbnQgbWFpbih2b2lkKSB7CiAgICBzdHJ1Y3QgVHJpYW5nbGUgdHJpYW5nbGU7CgogICAgLy8g44Om44O844K244O844GrM+i+uuOBrumVt+OBleOCkuWFpeWKm+OBl+OBpuOCguOCieOBhgogICAgcHJpbnRmKCLovrogYTogIik7CiAgICBzY2FuZigiJWxmIiwgJnRyaWFuZ2xlLmEpOwogICAgcHJpbnRmKCLovrogYjogIik7CiAgICBzY2FuZigiJWxmIiwgJnRyaWFuZ2xlLmIpOwogICAgcHJpbnRmKCLovrogYzogIik7CiAgICBzY2FuZigiJWxmIiwgJnRyaWFuZ2xlLmMpOwoKICAgIC8vIOODmOODreODs+OBruWFrOW8j+OBq+OCiOOCi+mdouepjeioiOeulwogICAgZG91YmxlIHMgPSAodHJpYW5nbGUuYSArIHRyaWFuZ2xlLmIgKyB0cmlhbmdsZS5jKSAvIDIuMDsKICAgIGRvdWJsZSBhcmVhID0gc3FydChzICogKHMgLSB0cmlhbmdsZS5hKSAqIChzIC0gdHJpYW5nbGUuYikgKiAocyAtIHRyaWFuZ2xlLmMpKTsKCiAgICAvLyDntZDmnpzjga7lh7rlipsKICAgIHByaW50ZigiXG7kuInop5LlvaLjga7ovro6IGEgPSAlLjJsZiwgYiA9ICUuMmxmLCBjID0gJS4ybGZcbiIsIHRyaWFuZ2xlLmEsIHRyaWFuZ2xlLmIsIHRyaWFuZ2xlLmMpOwogICAgcHJpbnRmKCLkuInop5LlvaLjga7pnaLnqY06ICUuMmxmXG4iLCBhcmVhKTsKCiAgICByZXR1cm4gMDsKfQ==