adplus-dvertising
frame-decoration

Question

Select the output for the following set of Code:
static void Main(string[] args)
 {
     int x = 0;  
     while (x < 20)
     {
         while (x < 10)
         {
             if (x % 2 == 0)
             {
                 Console.WriteLine(x);
             }
             x++;
         }
     }
     Console.ReadLine();
 }

a.

1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20

b.

0 2 4 6 8 10 12 14 16 18 20

c.

0 2 4 6 8

d.

0 2 4 6 8 10

Posted under C# programming

Answer: (c).0 2 4 6 8

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: