← Quiz: C Control Flow: all 10 questions
Quiz: C Control Flow · Question 7 of 10
What does this print? (code)
What does this print?
#include <stdio.h>
int main(void) {
int c = 0;
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++) {
if (j == 1) break;
c++;
}
printf("%d\n", c);
return 0;
}
- A.0
- B.3
- C.1
- D.9
Answer & explanation
Correct answer: 3
break leaves only the inner loop. Each of the 3 outer rounds counts once (j = 0) before breaking.
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 →