← Quiz: C Control Flow: all 10 questions
Quiz: C Control Flow · Question 6 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
int main(void) {
int sum = 0;
for (int i = 1; i <= 10; i++) {
if (i % 2 == 0) continue;
sum += i;
}
printf("%d\n", sum);
return 0;
}
- A.55
- B.30
- C.25
- D.9
Answer & explanation
Correct answer: 25
continue skips the even numbers, so only 1 + 3 + 5 + 7 + 9 = 25 is added.
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 →