Hello guys, don't know why this code does not work. It does not compile at all
Code:using System; class division { int i; int j; public division (int i, int j) { this.i = i; this.j = j; } public void divide(int n) { try { if (n/0) throw new DivideByZeroException("Divide by 0"); } catch (DivideByZeroException e) { Console.WriteLine("Exception: {0}", e); return; } Console.WriteLine(i / j); } } class Test { public static void Main() { division d = new division(3, 1); d.divide (2); Console.ReadLine (); } }




Reply With Quote