Hi Yuchuang,
Please check following thread:
Loop Help
I already advised a nested loop to solve a problem very similar to yours. To solve your problem, you just need to play with the loop parameters. Play with it and paste your code here if you can't solve your problem. But it is easy, you should be able to solve it.