Two things that jump out at me.
1 - there's no question asked. You won't get much help if you don't point us in the direction of where you're having trouble.
2 - see the sticky posts at top for information on good posting. Especially, use code tags, like this:
[code]
//your code goes here
[/code]
3- (OK, I said just two things, but anyway) comments in your code can be helpful. I see you have used descriptive names, which is good.
vmanes
Posting Virtuoso
1,914 posts since Aug 2007
Reputation Points: 1,268
Solved Threads: 228
You are incrementing the variable "i" instead of the variable "num".
thines01
Postaholic
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402