C hypot()

hypot() function Prototype

double hypot(double p, double b);

h = √(p2+b2) in mathematics is equivalent to h = hypot(p, b); in C Programming.

The hypot() function is defined in math.h header file.

Example: C hypot() Function

#include <stdio.h>
#include <math.h>

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;


hypot(5.00, 12.00) = 13.00
Did you find this article helpful?