That is the nature of how a for loop executes. For each iteration of the outer loop, the inner loop executes as a new statement.
Code:
for(initialization; condition; update)
{
...
}
"for (i=0; i<n; i++)"
Step 1) The first section, "i = 0", initialization ALWAYS executes, once, when the for loop starts.
Step 2) The second section, "i < n", the condition is tested, if true, the statements in the body of the for loop executes
Step 3) The third section, "i++", the loop variable is incremented
Step 4) The execution returns to Step 2, until the condition fails.
Again, please go back to a good book on the C Programming Language, and study the chapters on for(), while(), and do-while() loops!