Continue Statement in C Programming

The continue statement in C programming language is used to skip some statements inside the body of the loop and continues the next iteration of the loop. The continue statement only skips the statements after continue inside a loop code block.

The continue statement is used with conditional if statement. Use of continue statement, change the normal sequence of execution of statements inside loop.

Syntax of continue Statement

Control Flow of continue Statement C Continue Statement Control Flow Diagram
Use of continue Statement
We can use continue statement inside any loop(for, while and do-while). It skips the remaining statements of loop's body and starts next iteration.

If we are using continue statement inside nested loop, then it will only skip statements of inner loop from where continue is executed.

C Program to show use of continue statement

#include <stdio.h>
#include <conio.h>

int main(){
     * This program calculate sum of even numbers
    int N, counter, sum=0;
    printf("Enter a positive number\n");
    scanf("%d", &N);
    for(counter=1; counter <= N; counter++){
     * Using continue statement to skip odd numbers
        if(counter%2 == 1){
        sum+= counter;
    printf("Sum of all even numbers between 1 to %d = %d", N, sum);
Above program find sum of all even numbers between 1 to N, using for loop. It counter is odd number then continue statement will skip the sum statement.

Enter a positive number
Sum of all even numbers between 1 to 6 = 12