Nested loop –
Another Example
n*
n * *
n * * *
n * * * *
n * * * * *
nOne counting variable (i) to record how many lines
nAnother counting variable (j) to record how many stars in each line
n
One Solution:
for (i = 1; i <= 5; i++) { // control how many lines
   for (j = 1; j <= i; j++) // control how many stars in each line
cout << "* ";
    cout << endl;
}