static private double hyp(double a, double b)
return Math.Sqrt(a2 + b2);
static private double lrt(double a, double c)
return Math.Sqrt(c2 - a2);
public static void Main()
string restart = "This is wrong.";
Console.WriteLine("Press 1 if you are missing the hypotenuse and 2 if you are misssing the leg");
byte choice = byte.Parse(Console.ReadLine());
Console.WriteLine("Please enter the length of your first leg.");
double leg1 = double.Parse(Console.ReadLine());
Console.WriteLine("Please enter the length of your second leg.");
double leg2 = double.Parse(Console.ReadLine());
Console.WriteLine("The length of the hypotenuse of your right triangle is: " + hyp(leg1, leg2).ToString("##.##"));
Console.WriteLine("Please press 1 or 2.");
Console.WriteLine("press q to quit the program or any other key to continue.");
restart = Console.ReadLine();