0% found this document useful (0 votes)
1 views

Nested Loop

Nested loop using in coding

Uploaded by

malikhassan5156
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Nested Loop

Nested loop using in coding

Uploaded by

malikhassan5156
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Lecture 12 part B

Programming fundamentals
Previous Lecture
Outline
For loop
While and do while loop
Lecture Outline
Nested loop
Break
Continue
Nested Loops
• A loop can be nested inside another loop.

• Nested loops consist of an outer loop and one or more inner loops

• Each time the outer loop is repeated, the inner loops are
reentered, and started anew.
Code
Activity
Show the output of the following programs. (Tip: Draw a table and list
the variables in the columns to trace these programs.)
Activity
Break and
continue
• The break and continue keywords provide additional controls in a
loop.
• You have used the keyword break in a switch statement.
• You can also use break in a loop to immediately terminate the
loop.
Using break in a Nested Loop
• In a nested loop, the break statement only interrupts the loop it is
placed in.
Next Lecture

Arrays in C++

You might also like