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! While you're at it, check out some resources Treehouse students have shared here.
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.
Start your free trialSean Cansdale
3,075 PointsI'm check this over a few times and I'm unable to see the problem with my solution?
public static double CalculateHypotenuse(double a, double b) { return System.Math.Pow(a, 2) + System.Math.Pow(b, 2); }
namespace Treehouse.CodeChallenges
{
class RightTriangle
{
public static double CalculateHypotenuse(double a, double b) {
return System.Math.Pow(a, 2) + System.Math.Pow(b, 2);
}
}
}
1 Answer
Steven Parker
231,198 PointsYour method is calculating the sum of the squares of the two sides, but the Pythagorean Theorem says that the length of the hypotenuse would be the square root of that sum.
Sean Cansdale
3,075 PointsSean Cansdale
3,075 PointsCheers! I feel a bit stupid :)