Examveda

What will be the output of the following C# code?
static void Main(string[] args)
{
    int i;
    for (i =-3; i <= 3; i++)
    {
        switch (i)
        {
        case 0:
            Console.WriteLine("zero");
            break;
        }
        if (i > 0)
            Console.WriteLine("A");
        else if (i < 0)
            Console.WriteLine("B");
    }
    Console.ReadLine();
}

A. B B zero A A A

B. B zero A A A

C. B B B zero A A A

D. A A A zero B B B

Answer: Option C


Join The Discussion

Related Questions on Control Flow Statements in C Sharp