using System; using System.Collections.Generic; using System.Text; class PythagoreanTheo { static void Main(string[] args) { double a, b, c, r1, r2, r3; char ch1; Console.WriteLine("Enter the property you want to check:"); ch1 = char.Parse(Console.ReadLine()); r1 = Math.Sqrt(Math.Pow(a, 2) + Math.Pow(b, 2)); r2 = Math.Sqrt(Math.Pow(c, 2) - Math.Pow(a, 2)); r3 = Math.Sqrt(Math.Pow(c, 2) - Math.Pow(b, 2)); Console.WriteLine(); if (ch1 == 'c') { Console.WriteLine("Enter b and a"); b = double.Parse(Console.ReadLine()); a = double.Parse(Console.ReadLine()); Console.WriteLine("C is: " + r1); } else if (ch1 == 'b') { Console.WriteLine("Enter c and a"); c = double.Parse(Console.ReadLine()); a = double.Parse(Console.ReadLine()); Console.WriteLine("B is: " + r2); } else { Console.WriteLine("Enter c and b"); c = double.Parse(Console.ReadLine()); b = double.Parse(Console.ReadLine()); Console.WriteLine("A is: " + r3); } } }
|