First of all, the mods here take a rather dim view of people using us to do their homework.
You really need to make your best effort on this, on your own, and if you run into problems post your code (in code tags please) and we'll see what we can do...
FWIW... you don't actually need recursion to solve this problem...