Forgetting the semicolon after while(...) in a do-while gives
Q.Forgetting the semicolon after while(...) in a do-while gives
A) an infinite loop always
B) correct output
C) a warning only
D) a compile error
Correct Answer:
Option D
Detailed Explanation:
D) a compile error 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.