C program to Implement BREAK Statement

Break is a simple statement. It only makes sense if it occurs in the body of a switch, do, while or for statements.

When it is executed, the control flow jumps out of the loop when the condition met.

If you use break, it will go out of the loop and executes the statements out of the loop. Continue will just skip that particular iteration and continue the loop.

Break is mainly used in switch statement.

include

int main()
{
int i;
for (i=1; i<=10; i++)
{
printf(“\n%d”, i);
if (i == 6)
break;
}
return 0;
}
OUTPUT:
1
2
3
4
5
6

Leave a Reply

Your email address will not be published.