adplus-dvertising
frame-decoration

Question

Select the output for the following set of 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();
 }

a.

2 3 3

b.

3 2 3

c.

3 4 4

d.

5 10 10

Answer: (c).3 4 4

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Select the output for the following set of code :