C hypot () - C Standardbibliotek

Innehållsförteckning

Hypotenusen är den längsta sidan av en rätvinklig triangel. Funktionen hypot () används för att hitta hypotenus när andra två sidor tillhandahålls.

hypot () -funktion Prototyp

 dubbel hypot (dubbel p, dubbel b);

h = √(p2+b2)i matematik motsvarar h = hypot(p, b);C-programmering.

Funktionen hypot () definieras i rubrikfilen "> matematik.h.

Exempel: C hypot () -funktion

 #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; )

Produktion

 hypot (5.00, 12.00) = 13.00

Intressanta artiklar...