A

Admin • 833K Points
Coach

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
  • Correct Answer - Option(A)
  • Views: 13
  • Filed under category C Programming
  • Hashtags:

Explanation by: Admin

do-while loop prints 0, 1, and 2 before i becomes 3 and exits.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.