C hypot () - C Pustaka Standard

Hipotenus adalah sisi terpanjang segitiga bersudut tegak. Fungsi hypot () digunakan untuk mencari hypotenuse apabila dua sisi lain disediakan.

Prototaip fungsi hypot ()

 double hypot (double p, double b);

h = √(p2+b2)dalam matematik sama dengan h = hypot(p, b);dalam Pengaturcaraan C.

Fungsi hipot () didefinisikan dalam fail header "> math.h.

Contoh: C hypot () Fungsi

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

Pengeluaran

 hipot (5.00, 12.00) = 13.00

Artikel menarik...