Implement the Pythagorean Theorem in CSharp
Description
The following code shows how to implement the Pythagorean Theorem.
Example
using System; /*from www . ja v a 2 s. c o m*/
public class Pythagorean {
public static void Main() {
double s1;
double s2;
double hypot;
s1 = 12.12;
s2 = 13.13;
hypot = Math.Sqrt(s1*s1 + s2*s2);
Console.WriteLine("Hypotenuse is " + hypot);
}
}
The code above generates the following result.