static private double leg(double a, double c)
return Math.Sqrt(c * c - a * a);
static private double hyp(double a, double b)
return Math.Sqrt(a * a + b * b);
static private double area(double b, double h)
public static void Main()
string restart = "hello";
Console.WriteLine("Type '1' to find a hypotenuse, Type '2' to find a leg, Type '3' to find the area");
string input = Console.ReadLine();
Console.WriteLine("Please enter 2 legs of the triangle");
double num1 = double.Parse(Console.ReadLine());
double num2 = double.Parse(Console.ReadLine());
double output = hyp(num1, num2);
Console.WriteLine("The hypotenuse of is " + hyp(num1, num2));
Console.WriteLine("Please enter the leg of the triangle");
double num1 = double.Parse(Console.ReadLine());
Console.WriteLine("Please enter the hypotenuse of the triangle");
double num2 = double.Parse(Console.ReadLine());
Console.WriteLine("Leg cannot be bigger than the hypotenuse");
Console.WriteLine("The missing leg of the is " + leg(num1, num2));
Console.WriteLine("Please enter the base of the triangle");
double num1 = double.Parse(Console.ReadLine());
Console.WriteLine("Please enter the height of the triangle");
double num2 = double.Parse(Console.ReadLine());
double output = area(num1, num2);
Console.WriteLine("The area of the triangle is " + area(num1,num2));
Console.WriteLine("Please type '1', '2', or '3'");
Console.WriteLine("Type 'q' to quit, type anything else to restart");
restart = Console.ReadLine();