How does two nested for loop works

row=1, then condition will be checked, if condition is true it will enter the block
2ndly,
if the condition is true control moves to the inner for loop where col=1 and again condition will be checked, if condition true it will be entered inside

and value of row will be printed then col value will be incremented col++ and again condition will be checked if it false the control again moves to upper for loop and incremented value of the row, row++ and step moves till the upper condition get false.

Leave a Comment

Pin It on Pinterest

Share This
Open chat