C - LoopsWhich 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 */ }Check Answer
Step-by-Step SolutionSolution:Step 1: Recall C while loop syntaxThe condition must be inside parentheses and the code block inside braces.Step 2: Check each optionOnly while (condition) { /* code */ } uses correct parentheses and braces syntax.Final Answer:while (condition) { /* code */ } -> Option AQuick Check:Correct syntax uses parentheses and braces [OK]Quick Trick: Remember: while(condition) with parentheses and braces [OK]Common Mistakes:Omitting parentheses around conditionUsing square brackets instead of parenthesesAdding colon after while keyword
Master "Loops" in C9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More C Quizzes C Basics and Execution Environment - Why C is widely used - Quiz 12easy Conditional Statements - If statement - Quiz 2easy Input and Output - Multiple input and output - Quiz 5medium Input and Output - Using scanf for input - Quiz 15hard Loop Control Statements - Break statement - Quiz 13medium Loop Control Statements - Why loop control is required - Quiz 4medium Loops - For loop - Quiz 4medium Operators and Expressions - Arithmetic operators - Quiz 6medium Operators and Expressions - Why operators are needed - Quiz 10hard Operators and Expressions - Increment and decrement operators - Quiz 12easy