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

# hypotenuse

what is wrong with my code?

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

public static double CalculateHypotenuse(double leg1, double leg2)
{
leg1 = a;
leg2 = b;
//  double d ;

// d=(System.Math.Pow(leg1,2) +System.Math.Pow(leg2,2));
//return System.Math.Sqrt(d);
return System.Math.Sqrt(leg1 * leg1 + leg2 * leg2);
}

}
}
```

You create three empty private static variables, and then you assign the parameters of your CalculateHypotenuse method to these empty variables, overriding the values that actually was send into your method. Meaning that by the time your code gets to the return statement you are trying to multiply and do addition on the number 0, as that is what is assigned to all of your leg variables.

Your method declaration and return statement is correct, but all other lines of code you have written is unnecessary or wrong, if you remove these five lines:

```private static double a;
private static double b;
private static double c;
leg1 = a;
leg2 = b;
```

Like this:

```namespace Treehouse.CodeChallenges
{
class RightTriangle
{
//double longSide;

public static double CalculateHypotenuse(double leg1, double leg2)
{
//  double d ;

// d=(System.Math.Pow(leg1,2) +System.Math.Pow(leg2,2));
//return System.Math.Sqrt(d);
return System.Math.Sqrt(leg1 * leg1 + leg2 * leg2);
}

}
}
```

Then you will be able to complete the challenge.