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

PLUS

# What might be wrong with my code? Why doesn't Math.Sqrt work?

Add a public 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.

RightTriangle.cs
```namespace Treehouse.CodeChallenges
{
class RightTriangle
{
public static double CalculateHypotenuse(double leg1, double leg2)
{
return Math.Sqrt((leg1*leg1)+(leg2*leg2));
}
}
}
```

The `Math` class is a part of the `System` namespace, to use it you either have to declare that you are using it by including a `using` line like this at the top of your code:

```using System;
```

Or just specify `System` when accessing the `Math` class. In other words call `System.Math.Sqrt` instead of `Math.Sqrt`.

actually using Systems doesn't work for this case, I tried it! It only works when you put it in-front of the method ie(System.Math.Sqrt(...))

I always test my answers before I post them, I verified that both of the proposed solutions worked in this challenge. As Brendan mentions you have to be sure you type `System` not `Systems` and also remember to include the semicolon at the end. It also has to be placed above the class declaration, ideally at the very top of the solution. It won't work if you place it within the class or method.

PLUS

Thanks guys. It works. Apparently, I put the (using System ;) below the namespace instead of above. Really appreciate the help and concern shown