Q. What is the output of the following code?
Code:
int x = 0;
do {
System.out.println(x);
x++;
} while (x < 5);
β
Correct Answer: (A)
0 1 2 3 4
Explanation: The do-while loop prints the value of x on each iteration until x becomes greater than or equal to 5.