C Program using break statement


In this program, You will learn how to implement break statement in c.


if (condition){ break; }


Example: How to implement break statement in c

Run it Now
#include<stdio.h>

int main() {

   int i;
   for (i = 1; i <= 10; i++) {
       if (i == 6){
          break;
       }
       printf("%d \n", i);
   }
   printf("Exit From loop");

   return 0;
}

Output:

1
2
3
4
5
Exit From loop