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.

Start your free trial

C# C# Objects Loops and Final Touches Static Members

Jannung Kusdiantoro
Jannung Kusdiantoro
6,743 Points

missing 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
Jennifer Nordell
Treehouse Teacher

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


Hope this helps! :sparkles:

Rodger Voelkel
Rodger Voelkel
21,736 Points

You could also save yourself from having another variable by instead doing...

return Math.Sqrt(legs1*legs1 + legs2*legs2);