πŸ“Š JAVA
Q. What is the output of the following code?
Code:
int x = 0;
do {
System.out.println(x);
x++;
} while (x < 5);
  • (A) 0 1 2 3 4
  • (B) 1 2 3 4 5
  • (C) 0 1 2 3
  • (D) 1 2 3 4
πŸ’¬ Discuss
βœ… 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.

Explanation by: Deepak Sahoo
The do-while loop prints the value of x on each iteration until x becomes greater than or equal to 5.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
138
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Deepak Sahoo
Publisher
πŸ“ˆ
84%
Success Rate