Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter two numbers: ");
            int n1 = Convert.ToInt32(Console.ReadLine());
            int m1 = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter two numbers: ");
            int n2 = Convert.ToInt32(Console.ReadLine());
            int m2 = Convert.ToInt32(Console.ReadLine());

            Number example1 = new Number(n1, m1);
            Number example2 = new Number(n2, m2);

            if (!Number.Extraction(Console.ReadLine(), out example1))
            {
                Console.WriteLine("Error. Wrong input");;
            }
            Console.WriteLine(example1);
            Console.WriteLine("+");
            Console.WriteLine($"{(double)(example1 + example2)}");
            Console.WriteLine("-");
            Console.WriteLine($"{(double)(example1 - example2)}");
            Console.WriteLine("/ ");
            Console.WriteLine($"{(double)(example1 / example2)}");
            Console.WriteLine("*");
            Console.WriteLine($"{(double)(example1 * example2)}");
            Console.WriteLine(">");
            if (example1 > example2)
            {
                Console.WriteLine($"{(double)example1}");
            }
            else
            {
                Console.WriteLine($"{(double)example2}");
            }
            Console.WriteLine($"{(double)example2}");
            Console.WriteLine("<");
            if (example1 < example2)
            {
                Console.WriteLine($"{(double)example1}");
            }
            else
            {
                Console.WriteLine($"{(double)example2}");
            }

            Console.WriteLine(">= ");
            if (example1 >= example2)
            {
                Console.WriteLine($"{(double)example1}");
            }
            else
            {
                Console.WriteLine($"{(double)example2}");
            }
            Console.WriteLine("<=");
            if (example1 <= example2)
            {
                Console.WriteLine($"{(double)example1}");
            }
            else
            {
                Console.WriteLine($"{(double)example2}");
            }
            Console.WriteLine("==");

            if (example1 == example2)
            {
                Console.WriteLine("The numbers are equal");
            }
            else
            {
                Console.WriteLine("The numbers are not equal");
            }

            Console.WriteLine("convert to a string");
            Console.WriteLine(example1.ToString());
            Console.WriteLine(example2.ToString());
            Console.WriteLine("convert to an int");
            Console.WriteLine(example1.ToString());
            Console.WriteLine(example2.ToString());
            Console.WriteLine("convert to a double");
        }