Important MCQ

int i=0; do{i++;}while(i<5); final value of i is

Q.int i=0; do{i++;}while(i<5); final value of i is

A) 0
B) 4
C) 6
D) 5
Correct Answer:
Option D
Detailed Explanation:
D) 5 is correct. A do-while loop executes its body before checking the condition, so it runs at least once. Its closing while(condition) is followed by a semicolon.