hypotenuse function
Calculate the hypotenuse with pythagorean theorem
x
: cathetus Xy
: cathetus Y
Examples
print(truncate(1.4747474747474747, 3));
/* output:
1.475;
*/
Implementation
double hypotenuse(double x, double y) {
return sqrt(pow(x, 2) + pow(y, 2));
}