Logo

Programming-Idioms

History of Idiom 200 > diff from v13 to v14

Edit summary for version 14 by programming-idioms.org:
[C#] Seriously, not int

Version 13

2020-05-17, 18:34:01

Version 14

2020-05-18, 15:07:27

Idiom #200 Return hypotenuse

Returns the hypotenuse h of the triangle where the sides adjacent to the square angle have lengths x and y.

Idiom #200 Return hypotenuse

Returns the hypotenuse h of the triangle where the sides adjacent to the square angle have lengths x and y.

Variables
h,x,y
Variables
h,x,y
Extra Keywords
pythagore square geometry trigo trigonometry
Extra Keywords
pythagore square geometry trigo trigonometry
Code
int hypo(int x, int y)
{
    return Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
}
Code
double hypo(double x, double y)
{
    return Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
}