🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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;
}
  1. A.55
  2. B.30
  3. C.25
  4. 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 →