"HARD WORK BEATS TALENT WHEN TALENT DOSEN'T WORK HARD."
"HARD WORK BEATS TALENT WHEN TALENT DOSEN'T WORK HARD."
Break Statement is use to terminate the flow of switch case and to come out of the switch case.
We use break statement only in the two places in the program
break;
#include<stdio.h> #include<conio.h> void main() { int i; clrscr(); for(i=1; i<=10; i++) { if(i==6) { break; } printf("%d\n",i); } getch(); }
1 2 3 4 5
In above example we are terminating the iteration after 5 number with help of break statement. It will only print the numbers before the termination condition.