// // ヘロンの公式を用いて三角形の面積を求めるプログラム // #include #include int main(void) { double a, b, c; printf("三角形の面積を求めるプログラム\n"); printf("三辺の長さを空白で区切って入力してください。 "); scanf("%lf %lf %lf", &a, &b, &c); double t, s; t = (a + b + c) / 2.0; s = sqrt(t * (t - a) * (t - b) * (t - c)); printf("辺の長さ %8.2f, %8.2f, %8.2fからなる", a, b, c); printf("三角形の面積は %8.2f です。", s); }