Script Categories

Calculators >>> Pythagorean.

One of geometry's most useful formulas, the Pythagorean Theorem, can be applied to the numbers you enter in JavaScript! Just enter 'A' and 'B' and the script solves for 'C'.

The Pythagorean Theorem

( a2 + b2 = c2 )

2 + 2 =

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function solvepy(form) {
a = parseInt(form.a.value);
b = parseInt(form.b.value);
form.c.value = Math.sqrt(a*a + b*b);
//  End -->
The Pythagorean Theorem
tt>( a<sup>2</sup> + b<sup>2</sup> = c<sup>2</sup> )</tt>
<input type=text name=a size=3><sup>2</sup> +
<input type=text name=b size=3><sup>2</sup> =
<input type=text name=c size=8>
<input type=button value="Solve" onClick="solvepy(this.form)">

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).