Przeciwprostokątna to najdłuższy bok trójkąta prostokątnego. Funkcja hypot () jest używana do znajdowania przeciwprostokątnej, gdy dostępne są dwie inne strony.
hypot (), funkcja Prototyp
podwójne hypot (podwójne p, podwójne b);
h = √(p2+b2)
w matematyce odpowiada h = hypot(p, b);
programowaniu w C.
Funkcja hypot () jest zdefiniowana w pliku nagłówkowym "> math.h".
Przykład: funkcja C hypot ()
#include #include int main() ( double p, b; double hypotenuse; p = 5.0; b = 12.0; hypotenuse = hypot(p, b); printf("hypot(%.2lf, %.2lf) = %.2lf", p, b, hypotenuse); return 0; )
Wynik
hipotetyczny (5,00, 12,00) = 13,00