Use a debugger and watch the values of the locals (the variables in the current scope). It is also INCREDIBLY hard for someone to debug your code without a debugger or comments for that matter. Because we don't know the intention nor do we have all the code to figure out the intention. This is a good exercise in learning how to use a debugger. It'll also help you to understand how your code works and why it works the way it does. I suggest you go get a debugger and run your code through it then come to us with questions that aren't "Do my homework for me."
Sorry if I sounded rude, but you gotta learn sometime right?