adplus-dvertising
frame-decoration

Question

Select the output for the following set of code :
static void Main(string[] args)
 {
     int i, j;
     for (i = 1; i <= 3; i++)
     {
         j = 1;
         while (i % j == 2)
         {
             j++;
         }
         Console.WriteLine(i + " " + j);
     }
     Console.ReadLine();
 }

a.

11 21

b.

1 12 13 1

c.

11 21 31

d.

1 1 2 1 3 1

Posted under C# programming

Answer: (c).11 21 31

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 :