The break Statement
We often come across situations where we want to jump out of a loop instantly, without waiting to get back to the conditional test. The keyword break allows us to do this. When break is encountered inside any loop, control automatically passes to the first statement after the loop. A break is usually associated with an if. As an example.
Example
#include<stdio.h> int main( ) { int num, i ; printf ( "Enter a number " ) ; scanf ( "%d", &num ) ; i = 2 ; while ( i <= num - 1 ) { if ( num % i == 0 ) { printf ( "Not a prime number" ) ; break ; } i++ ; } getchar(); return 0; }