← Quiz: C Control Flow: all 10 questions
Quiz: C Control Flow · Question 5 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
int main(void) {
int count = 0;
for (int i = 1; i <= 20; i++) {
if (i % 3 == 0) count++;
}
printf("%d", count);
return 0;
}
- A.7
- B.6
- C.5
- D.20
Answer & explanation
Correct answer: 6
Multiples of 3 up to 20: 3, 6, 9, 12, 15, 18 — six numbers.
Can you get the rest right without peeking?
Take the timed Quiz: C Control Flow quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →