#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
| ホームページ | 目次 | 演習解答例目次 | 付録目次 | 索引 |