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 trialJannung Kusdiantoro
6,743 Pointsmissing something?
what did i miss here?
namespace Treehouse.CodeChallenges
{
class RightTriangle
{
public static double CalculateHypotenuse(double legs1, double legs2) {
double hypo = legs1*legs1 + legs2*legs2;
return Math.Sqrt(hypo);
}
}
}
3 Answers
Jennifer Nordell
Treehouse TeacherHi there! You forgot to tell it to use the System class. On the very first line of code you should have:
using System;
Here is some reference material from MSDN on the Math class which is contained within the System class.
https://msdn.microsoft.com/en-us/library/system.math(v=vs.110).aspx
Hope this helps!
Jannung Kusdiantoro
6,743 Pointsthank you, i forgot that one
Rodger Voelkel
21,736 PointsYou could also save yourself from having another variable by instead doing...
return Math.Sqrt(legs1*legs1 + legs2*legs2);