Break statement is used to exit from loop
Break statement in loops
Break statement immediately transfer control to the out of loop and statement which is immediately after loop is executed. In other word break statement terminate loop.
Note:-
# Break is terminated only one loop in case of nested loop
Example:-
c++ program to count N number using break statement
Example:-
Break statement in nested loop
Break statement in switch
The break statement transfer the control to out of the switch statement and statement which is immediately after switch is executed.
Note:-
# break is optional, if 2 or more case labels belongs to same statement.
Program to accept day number of week and display the corresponding week day
Previous Code:-
Switch case
List Code:-
C++ Codes
Next Code:-
Continue Statement
C++ Programs
List of c++ Programs
Switch case
List Code:-
C++ Codes
Next Code:-
Continue Statement
C++ Programs
List of c++ Programs
Leave reply
Add your comments here