Bird
0
0

Which of the following is the correct syntax for a while loop in C?

easy📝 Syntax Q12 of 15
C - Loops
Which of the following is the correct syntax for a while loop in C?
Awhile (condition) { /* code */ }
Bwhile condition { /* code */ }
Cwhile [condition] { /* code */ }
Dwhile: (condition) { /* code */ }
Step-by-Step Solution
Solution:
  1. Step 1: Recall C while loop syntax

    The condition must be inside parentheses and the code block inside braces.
  2. Step 2: Check each option

    Only while (condition) { /* code */ } uses correct parentheses and braces syntax.
  3. Final Answer:

    while (condition) { /* code */ } -> Option A
  4. Quick Check:

    Correct syntax uses parentheses and braces [OK]
Quick Trick: Remember: while(condition) with parentheses and braces [OK]
Common Mistakes:
  • Omitting parentheses around condition
  • Using square brackets instead of parentheses
  • Adding colon after while keyword

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes