Nested loop –
First Example
nfor (int i = 1; i < 4; i++) { // start of outer loop
n cout << "\n\n i is now : " << i << endl;
n for (int j = 1; j < 5; j++) // start of inner loop
n cout << "   j = " << j;            // end of inner loop
n } // end of outer loop
nThe first loop, controlled by i, is called outer loop
nThe second loop, controlled by j, is called inner loop
n
nAll statements in the inner loop are contained the boundaries of the outer loop and we use a different variable for each loop
nFor each single trip through the outer loop, the inner loop runs through its entire sequence.
nIn other words, each time the i counter increases by 1, the inner for loop executes completely