Examveda

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

B. 0 5

C. 0 -10

D. Compile time error

Answer: Option C


Join The Discussion

Related Questions on Exception Handling in C Sharp