English

Explain Continue and Break Statements with the Help of Suitable Examples.

Advertisements
Advertisements

Question

Explain continue and break statements with the help of suitable examples.

Answer in Brief
Advertisements

Solution

1. continue statement-the continue statement also neglects the statements after it in the Loop and transfers the control back to the starting of the loop for next iteration.

*operation of continue statement in a for loop.

*operation of continue statement in a while loop

*operation of continue statements in a do-while loop

                      do

2.Break statement:
                The break statement neglects the statement after it in the loop and transfers the control outside the loop
*operation of break statement in a for loop
for(initialization;condition;inc/dec)

*operation of break statement in a while loop

while(condition)

*operation of break statement in a do-while loop

                          do

shaalaa.com
Control Structures - Looping
  Is there an error in this question or solution?
2016-2017 (June) CBCGS
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×