static void Main(string[] args) { try { Tester t = new Tester(); double answer = t.DoDivide(12, 4); Console.WriteLine("DoDivide(12,4) = {0}", answer); answer = t.DoDivide(0, 4); Console.WriteLine("DoDivide(0,4) = {0}", answer); } catch (DivideByZeroException ex) { Console.WriteLine(ex.Message); } catch (MyCustomException ex) { Console.WriteLine(ex.Message); } }
static void Main(string[] args) { try { Tester t = new Tester(); double result = t.DoDivide(77, 0); Console.WriteLine("Divide 77 and 0 is equal {0}", result); result = t.DoDivide(12, 4); Console.WriteLine("Divide 12 and 4 is equal {0}", result); result = t.DoDivide(0, 10); Console.WriteLine("Divide 0 and 10 is equal {0}", result); } catch (DivideBy0Exception ex) { Console.WriteLine(ex.Message); } catch (MyCustomException ex) { Console.WriteLine(ex.Message); } }