예제 #1
0
        static void Main(string[] args)
        {
            MathProxy proxy = new MathProxy();

            Console.WriteLine($"4 + 2 = {proxy.Add(4, 2)}");
            Console.WriteLine($"4 - 2 = {proxy.Sub(4, 2)}");
            Console.WriteLine($"4 * 2 = {proxy.Multiply(4, 2)}");
            Console.WriteLine($"4 / 2 = {proxy.Divide(4, 2)}");

            try
            {
                Console.WriteLine($"4 / 0 = {proxy.Divide(4, 0)}");
            }
            catch (DivideByZeroException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            MathProxy _mathProxy = new MathProxy();

            Console.WriteLine("2 + 2 = {0}", _mathProxy.Add(2, 2));
            Console.WriteLine("2 - 2 = {0}", _mathProxy.Subtract(2, 2));
            Console.WriteLine("2 * 2 = {0}", _mathProxy.Multiply(2, 2));
            Console.WriteLine("2 / 2 = {0}", _mathProxy.Divide(2, 2));
            Console.ReadKey();
        }