#include <math.h> double hypot(double x, double y) x, y : 倍精度浮動小数点数.sqrt( x * x + y * y ) が計算されます.
#include <stdio.h>
#include <math.h>
int main()
{
double x;
x = hypot(3.0, 4.0);
printf("二辺の長さが 3.0 と 4.0 の直角三角形の斜辺は %5.1f\n", x);
return 0;
}
二辺の長さが 3.0 と 4.0 の直角三角形の斜辺は 5.0
| 菅沼ホーム | 本文目次 | 演習問題解答例 | 付録目次 | 索引 |