ExamVeda
Login
Home
Control Flow Statements in C Sharp
?

What will be the output of the following C# code?
static void Main(string[] args)
{
    int i = 2, k = 3;
    switch (i - k)
    {
    case -1:
        ++i;
        ++k;
        break;
    case 2:
        --i;
        ++k;
        break;
    default:
        i += 3;
        k += i;
        break;
    }
    Console.WriteLine(i + "\n" + k);
    Console.ReadLine();
}

Answer & Solution
Correct Answer: Option C
Let's discuss the solution. Join the discussion
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.