All articles
c

A program to explain unconditional statement BREAK

Share this article

Share on LinkedIn Share on X (formerly Twitter)

C Programming Language 039

The following code shows how to write a program to explain unconditional statement BREAK inside a for loop.

Program

#include <stdio.h>
 
void main()
{
    int i;
    for (i = 0; i <= 10; i++)
    {
        printf("%d\n", i);
        if (i == 3)
        {
            break;
        }
    }
 
    printf("\n");
}

Result

0
1
2
3

Comments