break Statement in C

The break statement is used to break the execution of body of loop. When this statement is encountered, the control is directly transferred to the statement immediately after the loop body. break is also used in switch-case statement to transfer the control of execution from the statements of some case to the statement immediately after the switch-case construct. Program 1 shows the working of break statement followed by the output.

#include <stdio.h>
void main()
{
int num, count;
printf(“Enter the number? ”);
scanf(“%d”, &num);
for( count=1; count < 10; count++)
{
if (num == count)
break;
printf(“Number %d/10 display\n”,
count);
}
}

Program 1 Program to show the working of break statement.

Screenshot from 2020-07-16 16-50-11