Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: Creating a Pythagorean Theorem Calculator (Simple!)

1. ## Creating a Pythagorean Theorem Calculator (Simple!)

Hey guys. This should be extremely easy for you to answer. This is actually for an intro to computers class I am taking and I am completely stumped. Basically I have to create a really simple Pythagorean Theorem calculator and this is what I have so far:

[CODE]
<html>
<title>A Pythagoras Conversion</title>

<script type="text/javascript">

var right_leg, left_leg, hypotenuse;

alert ("This calculates the hypotenuse of a right-angled triangle using the Pytahgorean Thereom. Press <OK> to continue!");

right_leg=prompt("Enter the length of the right leg.");

left_leg=prompt("Enter the length of the left leg.");

sq1 = right_leg*right_leg;
sq2 = left_leg*left_leg;

hypotenuse = math.sqrt(sq1 + sq2);

</script>

<body>
</body>
</html>
[CODE]

Everything works except for when it comes to it actually calculating. The calculation window never pops up. Please tell me what I am doing wrong in the calculation here....it is driving me nuts. :/

Thanks so much...

• Code:
```hypotenuse = Math.sqrt(sq1 + sq2);
alert ("The Hypotenuse= " + hypotenuse);```

"Life is like a mirror, we get the best results when we smile at it. " - Anonymous

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•