google it. I can't wait......
Look through it and compare it to the code you have written. You will see it. It follows the outline I posted for you and adds a couple variables to accomplish the task. Also the importance of resetting some loop counters.
It was just leftover from your initial declarations that I copied. Didn't feel like changing them. Anything initialized in the loops doesn't have to be in the declarations. I should have specified that I didn't look that closely at your code, just worked it so the logic control flow would work out. I am confident in your ability to go through and make the appropriate changes. Feel free to ask additional questions so you understand exactly why what you were doing didn't work.
This is my freebie though. In the future you may want to start a little earlier and work out the programs as has been suggested to you. For instance, I am sure you are going to get another project tomorrow after you turn this one in. Sit down, work it out in psuedo code, then start to code. If you get questions or stuck, come back here and post your issue, your psuedo code, and what you did in code. Start early. That is the way to get the best help on this board, showing the effort, which includes proper planning ahead.
No, the loop counters need to be reset to 0 where they are in the loops. If they are initialized in the loops they do not need to be initialized when they are declared.
Note the difference between declared and initialized.