Vidyalelo
C# Programming · Q43

Exception Handling in C Sharp

Programming · C# Programming · question 43

Q43

What will be the output of the following C# code? try int i, sum; sum = 10; for (i = -1 ;i < 3 ;++i) sum = (sum / i); Console.WriteLine(i); catch(ArithmeticException e) Console.WriteLine("0"); Console.ReadLine();

A.
-1
B.
0
C.
-1 0
Answer
D.
-1 0 -1

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board