---
title: "Break versus continue"
subject: "Computer Programming"
chapter: 5
key: "semester_1/computer_programming:break-vs-continue"
source: https://www.bctengineer.com/q/semester_1/computer_programming/break-vs-continue
site: BCT Engineering
---

# Break versus continue

Computer Programming · Chapter 5: Control statements

- Asked in: 2070 Asar, 4 marks; 2069 Chaitra, 3 marks; 2072 Kartik, 2 marks (asked 3 times)
- Video: [Break & Continue in C Programming with example](https://www.youtube.com/watch?v=RnYxuR6E3vA) — Gate Smashers
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_1/computer_programming/break-vs-continue
- Whole chapter: https://www.bctengineer.com/md/semester_1/computer_programming/chapter-5

## Question

Distinguish between break and continue statement with example.

## Short answer

break terminates the loop entirely, transferring control after the loop; continue skips the rest of the current iteration and proceeds to the next. Example: break in a loop for i=1..10 when i==5 yields 1 2 3 4; continue skips just 5, yielding 1 2 3 4 6 7 8 9 10.

## Answer

| `break` | `continue` |
|---|---|
| Terminates the loop (or `switch`) completely | Skips the rest of the current iteration only |
| Control goes to the statement after the loop | Control goes to the next iteration (loop condition or update) |
| Used in loops and `switch` | Used only in loops |
| Needed to end each `case` of a `switch` | Cannot be used to end a `switch` case |

```c
#include <stdio.h>
int main(void)
{
    int i;
    printf("break   : ");
    for (i = 1; i <= 10; i++)
    {
        if (i == 5)
            break;          /* leaves the loop */
        printf("%d ", i);
    }
    printf("\ncontinue: ");
    for (i = 1; i <= 10; i++)
    {
        if (i == 5)
            continue;       /* skips only i = 5 */
        printf("%d ", i);
    }
    printf("\n");
    return 0;
}
```
Output:
```text
break   : 1 2 3 4 
continue: 1 2 3 4 6 7 8 9 10
```

With `break`, the loop stops at 5; with `continue`, only 5 is skipped and the loop goes on up to 10.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What does break do in a loop?
   A. Skips the current iteration
   B. Terminates the loop completely
   C. Restarts the loop
   D. Ends the program
   Answer: B. Control goes to the statement after the loop. (Key point: break)

2. What does continue do?
   A. Terminates loop
   B. Skips the rest of the current iteration
   C. Exits switch
   D. Returns
   Answer: B. It goes to the next iteration. (Key point: continue)

3. Which is usable in a switch case?
   A. continue
   B. break
   C. both
   D. neither
   Answer: B. break ends each case; continue is only for loops. (Key point: switch)

4. For i from 1 to 10, with continue when i==5, the output is:
   A. 1 2 3 4
   B. 1 2 3 4 6 7 8 9 10
   C. 1 2 3 4 5
   D. 6 7 8 9 10
   Answer: B. Only 5 is skipped. (Key point: Output)

## Related in Computer Programming

- [Purpose of continue statement](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Acontinue-purpose) — Computer Programming, chapter 5
