break statement in do while loop
C Programming Language Loop control in C Language (Article) Loop control in C Language (Program)
882Program:
#include void main () { int a = 10 ; do { printf("value of a: %d\n", a); a++; if( a > 15 ) { break; } }while( a < 20 ); }
Output:
value of a: 10 value of a: 11 value of a: 12 value of a: 13 value of a: 14 value of a: 15 Press any key to continue . . .
Explanation:
This will print 10 to 15, after that the break will take place for that it terminates.
When the break statement is encountered inside a loop, the loop is immediately terminated, and program control resumes at the next statement following the loop.
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.