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 answer = "This will quit the program";
Console.WriteLine("Press 1 if you are trying to find the hypotenuse and press 2 if you are trying to find 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 enter the length of your leg");
double leg = double.Parse(Console.ReadLine());
Console.WriteLine("Please enter the length of your hypotenuse");
double hyp = double.Parse(Console.ReadLine());
Console.WriteLine("The length of the hypotenuse of your right triangle is: " + lrt(leg, hyp).ToString("##.##"));
Console.WriteLine("Please press 4 or 8 to decide which path you want to go on");
Console.WriteLine("Press q to quit the program or any other key to continue.");
answer = Console.ReadLine();