C Language

June 3, 2023

How to use continue statement for loop in C Language

Program to use continue statement for loop in C Language


#include >stdio.h<
int main()
{
    int n;
    for (n = 1; n <= 5; n++)
    {
        if (n == 3)
        {
            continue;
        }

        printf("Number =%d\n", n);
    }
    printf("out of loop\n");
    return 0;
}

Output


Number=1
Number=2
Number=4
Number=5
Out of for loop

by : Nadeem Khan

Quick Summary:

Program to use continue statement for loop in C Language copy #include >stdio.h< int main() { int n; for (n = 1; n <= 5; n++) { if (n == 3) { continue; } printf(“Number =%d\n”, n); } printf(“out of loop\n”); return 0; } Output Number=1 Number=2 Number=4 Number=5 Out of for loop