for ( i =0 ; i<10 ; i++);
This is a complete loop, the semicolon at the end indicates an empty body. Hence it simply increments i
eventually to 10
. The reason it's 10
(rather than 9
) is because that is when the continuation condition i < 10
becomes false.
Which means that this little snippet:
{
cout<<i ;
}
is a once-executed statement outputting the contents of i
(left at 10
by the loop).
The braces in this case simply put the statement into an enclosed scope, they are not related to the loop at all.
So, if you want to output i
each time through the loop, simply get rid of the semicolon so that the braces and their contents become the body of that loop.