Facebook Page Twitter Page LinkedIn Page
× C Tutorial C Resources


The C math hypot() function is used to return square root of sum of squares of two arguments, i.e., sqrt(x2 +y2).

Syntax

double hypot(double x, double y);

Parameters

x Specify a value.
y Specify a value.

Return Value

Returns sqrt(x2 +y2).

Example:

In the below example, hypot() function is used to return sqrt(x2 +y2).

#include <stdio.h>
#include <math.h>
 
int main (){
  printf("%lf\n", hypot(3, 4));
  printf("%lf\n", hypot(5, 12));
  printf("%lf\n", hypot(8, 15));  
  return 0;
}

The output of the above code will be:

5.000000
13.000000
17.000000

❮ C <math.h> Library