public static void Main(string[] args)
Console.WriteLine("Max(1, 2, 3) is 3: " + (Max(1, 2, 3) == 3));
Console.WriteLine("Max(5, 6, 4) is 6: " + (Max(5, 6, 4) == 6));
Console.WriteLine("Max(9, 4, 3) is 9: " + (Max(9, 4, 3) == 9));
Console.WriteLine("Max(9, 9, 9) is 9: " + (Max(9, 9, 9) == 9));
Console.WriteLine("Factorial(1) is 1: " + (Factorial(1) == 1));
Console.WriteLine("Factorial(5) is 120: " + (Factorial(5) == 120));
Console.WriteLine("First(4, 3, 1) is 59/6: " + (First(4, 3, 1) == 59.0 / 6.0));
Console.WriteLine("First(5, 12, 3) is 43/2: " + (First(5, 12, 3) == 43.0 / 2.0));
Console.WriteLine("Second(4, 0) is 2: " + (Second(4, 0) == 2));
Console.WriteLine("Second(2, 5) is 2.7002782... : " + (Second(2, 5) == Math.Sqrt(2 + Math.Sqrt(4 + 6 + 8 + 10))));
static double Max(double a, double b, double c)
return (a > b) ? ((a > c) ? a : c) : ((b > c) ? b : c);
static int Factorial(int n)
return n * Factorial(n - 1);
static double First(double x, double y, double z)
double a = 2 * Math.Sqrt(x * x + y * y) - (z * z * z) / Factorial(3);
double b = 1 - Math.Sqrt(x * x + y * y);
double c = Math.Sin((z * z * z) / Factorial(3)) + Math.Cos(Math.PI / 4);
static double Second(double x, int n)
for (int i = 2; i <= n; i++)
return Math.Sqrt(x + Math.Sqrt(sum));