What have you done so far? This sounds a lot like a homework assignment, and it seems someone else in your class is asking for help with it, too. If you post your own ideas about how to get started, there are a lot of people here that will be more than willing to help clarify any parts you don't understand.
As a hint, you will probably need to use a for loop, or even a couple of nested for loops.
I hope you come back with some specific questions. Feel free to post short snippets of code as well as compiler errors or any other information that will describe the problems you encounter along the way.