## Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today. # Why is it saying "Is your math correct?"

Add a static method named CalculateHypotenuse to the RightTriangle class that returns the length of long side of a right triangle (the hypotenuse), given the length of each of the the two shorter sides (the legs). The Pythagorean theorem will come in handy. The method should take two parameters of type double and return a double.

namespace Treehouse.CodeChallenges { class RightTriangle { private static double a; private static double b; private static double c;

```    public static double CalculateHypotenuse(double sideA, double sideB)
{
sideA = a;
sideB = b;

return c = System.Math.Sqrt(sideA * sideA) + System.Math.Sqrt(sideB * sideB);
}
}
```

}

RightTriangle.cs
```namespace Treehouse.CodeChallenges
{
class RightTriangle
{
private static double a;
private static double b;
private static double c;

public static double CalculateHypotenuse(double sideA, double sideB)
{
sideA = a;
sideB = b;

return c = System.Math.Sqrt(sideA * sideA) + System.Math.Sqrt(sideB * sideB);
}
}
}
``` The correct formula should be "the square root of the sum..." instead of "sum of the square roots..." You are also reassigning sideA and sideB to different values (most likely zero if there is no other way to initialize/set them).

```        public static double CalculateHypotenuse(double sideA, double sideB)
{
return System.Math.Sqrt(sideA * sideA + sideB * sideB);
}
```

Thanks!

Another alternative is to use Math.Pow like this

```        public static double CalculateHypotenuse(double sideA, double sideB) {
return System.Math.Sqrt(System.Math.Pow(sideA, 2) + System.Math.Pow(sideB, 2));
}
```

although you may want to add

```using System;
```

to make it look cleaner.

```namespace Treehouse.CodeChallenges
{
class RightTriangle
{
public static double CalculateHypotenuse (double _legOfA, double _legOfB) => System.Math.Sqrt (System.Math.Pow (_legOfA, 2) + System.Math.Pow (_legOfB, 2) );
}
}
```

Yet another solution.

```using System;
namespace Treehouse.CodeChallenges
{
class RightTriangle
{
public static double CalculateHypotenuse(double first, double second)
{
return Math.Sqrt(Math.Pow(first,2)+Math.Pow(second, 2));
}
}
}
```