Just as decisions can be nested, so can loops; that is, you can place
loops inside other loops. This can be useful, for example, when you are
coding multidimensional arrays. (See Arrays.)
The example below prints a square of asterisks by nesting a
printf command inside an inner loop, which is itself nested
inside an outer loop.
Any kind of loop can be nested. For example, the code below could have
been written with while loops instead of for loops: