😸
[C] hypot 関数
機能
2つの値の直角三角形の斜辺の長さ(平方根の和)を計算する[1]
使用例
5.000000
と表示する
\n
は改行を表す エスケープシーケンス[2]
コード
printf("%f\n", hypot(3.0, 4.0));
全文
#include <stdio.h>
#include <math.h>
void main() {
printf("%f\n", hypot(3.0, 4.0));
}
実行結果
5.000000
10.816654
を変数から表示する
コード
double x = 6.5, y = 8.5;
printf("%f\n", hypot(x, y));
全文
#include <stdio.h>
#include <math.h>
void main() {
double x = 6.5, y = 8.5;
printf("%f\n", hypot(x, y));
}
実行結果
10.816654
Discussion