Thanks again for your replies. I really appreciate that you took time out to help me on what are pretty basic questions.
I think I understand the equivalent code but just in case I will explain (my idea) here and also my new idea about the previous code.
While Loop
the integer i is given a value of 5 and then immediately incremented to 6 and while(i) is true it prints 6. Then the value of i is changed to i = i - 3 which is 3 and incremented to 4 and as i is still true it prints 4 and then the same process happens and it prints 2 and then the value of i is changed to i = i - 3 which is -1 and that is incremented to 0 and therefore the while loop stops because i = 0 which means false.
For Loop
i is declared as an integer and in the while loop is given a value of 5 which is true and that is incremented by the ++i to 6 which is printed and then the value is changed to 3 then incremented to 4 and therefore it is also printed and then the value is changed to 1 then incremented to 2 which is true and therefore printed and the value is changed to -1 and it is incremented to 0 which is false and therefore not printed and the loop ends.
I think I know where my confusion was coming from. The first part of the loop is just the initialization and then the second part is the condition which gets executed, changes the value of i and is also evaluated as true or false depending on its value being zero or non-zero and if it is true it will go to the third part be executed and go back to second part skipping the first part because it is merely an initialization. The loop is basically between the second two parts.
Sorry for the ramble. I will put my confusion in note form below.
1/ I thought the first part was a condition for some reason. (mistake - just initialization)
2/ I didn't realize that the second part acts as both a condition and changes the value. (mistake - it does)
3/ I though that after the third part it goes back to the first part. (mistake - it goes back to the second part)
@Elysia - This program is from a textbook my boss gave me so I can't choose how to write it really but thanks for telling me it's retarded. Although me calling it retarded is like the pot calling the kettle black.

