Computer Science, asked by kasireddyrajesh166, 4 months ago

illustrate the use of break in Loop statement with an example​

Answers

Answered by Anonymous
0

Answer:

When a break statement is encountered inside a loop, the loop is immediately terminated and the program control resumes at the next statement following the loop. It can be used to terminate a case in the switch statement (covered in the next chapter).

Answered by SᴘᴀʀᴋʟɪɴɢCᴀɴᴅʏ
21

\huge\pink{\underline{Good-Evening}}\huge\blue{\fbox{\fbox{\fbox{\red{\mathcal{Hlo}}}}}}

The break statement in C programming has the following two usages −

1.When a break statement is encountered inside a loop, the loop is immediately terminated and the program control resumes at the next statement following the loop.

2.It can be used to terminate a case in the switch statement (covered in the next chapter).

If you are using nested loops, the break statement will stop the execution of the innermost loop and start executing the next line of code after the block.

The break statement exits a for or while loop completely. To skip the rest of the instructions in the loop and begin the next iteration, use a continue statement. break is not defined outside a for or while loop. To exit a function, use return .

Attachments:
Similar questions