Determine the output of the program: int x = 0; while (x < 5) { x += 2; } cout << x;?
Show answer
Correct answer C
Initial value: x = 0 Loop runs while x < 5 Iterations: 1st: x = 0 + 2 = 2 2nd: x = 2 + 2 = 4 3rd: x = 4 + 2 = 6 Now x = 6, condition x < 5 becomes false, loop stops. Final value printed is 6.