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(); }
Select one: 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
Answer c. 0 2 4 6 8
Here we are printing the even values from 0-10 so it will print 0,2,4,6,8. here we are iterating <10 so it will print the value 10;
Get Answers For Free
Most questions answered within 1 hours.