Now we’ll apply the for statement in a complete program. This example does the same thing as Example 2.2 on page 43: It prints all the numbers from 1 to n. But this version is more compact.
Let’s start by looking at one of the simplest programs possible that uses an array. The rest of the chapter gets into more interesting programming challenges.