Q. What is the output of this loop?

Code:
int i = 0;
do {
    printf("%d ", i);
    i++;
} while(i < 3);
  • (A) 0 1 2
  • (B) 1 2 3
  • (C) 0 1 2 3
  • (D) 0 1
πŸ’¬ Discuss
βœ… Correct Answer: (A) 0 1 2
Explanation: do-while loop prints 0, 1, and 2 before i becomes 3 and exits.
Explanation by: Mr. Dubey
do-while loop prints 0, 1, and 2 before i becomes 3 and exits.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
104
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
88%
Success Rate