Bird
0
0

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

easy📝 Syntax Q12 of 15
C - Loops
Which of the following is the correct syntax to start a for loop in C?
Afor (int i = 0; i < 5; i++) { }
Bloop (i = 0; i < 5; i++) { }
Cfor i = 0 to 5 { }
Dfor i in range(5): { }
Step-by-Step Solution
Solution:
  1. Step 1: Recall C for loop syntax

    The correct for loop in C uses parentheses with initialization, condition, and increment separated by semicolons.
  2. Step 2: Check each option

    for (int i = 0; i < 5; i++) { } matches the correct C syntax: for (int i = 0; i < 5; i++) { }.
  3. Final Answer:

    for (int i = 0; i < 5; i++) { } -> Option A
  4. Quick Check:

    C for loop syntax = for (init; condition; increment) [OK]
Quick Trick: C for loops use semicolons inside parentheses [OK]
Common Mistakes:
  • Using Python or other language syntax
  • Missing semicolons in for loop
  • Using wrong keywords like 'loop'

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes