Step 4 of 6
break and continue
breakleaves the loop immediately.continueskips the rest of this round and jumps to the next one.
for (int i = 1; i <= 10; i++) {
if (i % 2 == 0) continue; // skip even numbers
if (i > 7) break; // stop after 7
printf("%d ", i);
}
// 1 3 5 7
Your turn: read numbers until you see 0. Ignore negative numbers. Print the sum of the positive ones. Use break for the 0 and continue for negatives.