---
title: "Purpose of continue statement"
subject: "Computer Programming"
chapter: 5
key: "semester_1/computer_programming:continue-purpose"
source: https://www.bctengineer.com/q/semester_1/computer_programming/continue-purpose
site: BCT Engineering
---

# Purpose of continue statement

Computer Programming · Chapter 5: Control statements

- Asked in: 2072 Kartik, 1+2 marks
- 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/continue-purpose
- Whole chapter: https://www.bctengineer.com/md/semester_1/computer_programming/chapter-5

## Question

What are the purpose of the continue statement? Within which control statements can continue statement be included?

## Short answer

The continue statement skips the remaining statements of the current loop iteration and immediately proceeds to the next iteration. It can only be used inside loops: for, while, and do-while.

## Answer

#### Purpose of `continue`
The `continue` statement skips the remaining statements of the current iteration of a loop and moves control directly to the next iteration (in a `for` loop, to the update expression; in `while` and `do-while`, to the condition test). It lets us ignore particular cases without leaving the loop.

```c
#include <stdio.h>
int main(void)
{
    int i, sum = 0;
    for (i = 1; i <= 10; i++)
    {
        if (i % 2 == 0)
            continue;       /* skip even numbers */
        sum += i;
    }
    printf("Sum of odd numbers 1..10 = %d\n", sum);
    return 0;
}
```
Output:
```text
Sum of odd numbers 1..10 = 25
```

#### Where it can be used
`continue` can be used only inside loops: `for`, `while` and `do...while`. It may be written inside an `if` or a `switch` that is itself inside a loop, but not outside a loop.

## Check yourself

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

1. What does continue do?
   A. Skips the rest of the current iteration and goes to the next
   B. Exits the loop completely
   C. Ends the program
   D. Restarts the program
   Answer: A. continue skips remaining statements of the iteration only. (Key point: Continue effect)

2. In a for loop, where does control go after continue?
   A. To the loop initialisation
   B. To the update expression
   C. Out of the loop
   D. To the first statement of main
   Answer: B. In for, continue jumps to the update expression. (Key point: For loop continue)

3. Where can continue be used?
   A. Only inside switch
   B. Anywhere in a program
   C. Only inside loops (for, while, do...while)
   D. Only in main
   Answer: C. continue needs an enclosing loop; it may sit inside an if or switch in a loop. (Key point: Where allowed)

4. The odd-sum example (continue on even i, 1..10) prints what?
   A. 30
   B. 55
   C. 20
   D. 25
   Answer: D. 1+3+5+7+9 = 25. (Key point: Example result)

## Related in Computer Programming

- [Need of control statements](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Awhy-control-statements) — Computer Programming, chapter 5, asked 2×
- [Break versus continue](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Abreak-vs-continue) — Computer Programming, chapter 5, asked 3×
- [Purpose of semicolon](https://www.bctengineer.com/question.md?key=semester_1%2Fcomputer_programming%3Asemicolon-purpose) — Computer Programming, chapter 3

## Related in other subjects

- [Purpose of PID tuning; computer control benefits](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Apid-tuning-purpose-benefits) — Embedded System, chapter 7
- [Second law statements; Kelvin-Planck and Clausius equivalence](https://www.bctengineer.com/question.md?key=semester_2%2Ffundamental_of_thermodynamics_and_heat_transfer%3Asecond-law-classical-kelvin-clausius) — Fundamental of Thermodynamics & Heat Transfer, chapter 5
- [Assembler statements and directives](https://www.bctengineer.com/question.md?key=semester_4%2Fmicroprocessor%3Aassembly-directives) — Microprocessor, chapter 3, asked 4×
- [Problem statement and UML building blocks](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Aresult-management-problem-statement-uml-blocks) — Object Oriented Analysis and Design, chapter 2
