## 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. # help plz

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. Important: In each task of this code challenge, the code you write should be added to the code from the previous task. Restart Preview Get Help Check Work RightTriangle.cs

1 namespace Treehouse.CodeChallenges 2 { 3 class RightTriangle 4 { 5

6 } 7 } 8 ​

RightTriangle.cs
```namespace Treehouse.CodeChallenges
{
class RightTriangle
{

}
}
``` For this exercise they are looking for a static method which calculates the third side of a triangle, using the pythagoreom theorem c squared = a squared + b squared and its equivalent, c = square_root(a squared + b square), you can use the Math library Sqrt to calculate the hypotenuse:

```using System;

namespace Treehouse.CodeChallenges
{
class RightTriangle
{
public static double CalculateHypotenuse(double a, double b) {
// c^2 = a^2 + b^2, or c = sqrt(a^2 + b^2)
return Math.Sqrt(a*a + b*b);

}

}
}
``` As you figured out, you can use the System namespace directly to access the Math.Sqrt function:

```namespace Treehouse.CodeChallenges {
class RightTriangle {
public static double CalculateHypotenuse(double a, double b) {
return System.Math.Sqrt(a*a + b*b);
}
}
}
``` Thanks Chris.

I wonder if you may be able to advise me on this please?

Why do we not need to use System.Math.Sqrt() ?

If System is namespaced at the top is it not needed?

Regards