Originally posted by Jeff Storey:
Yuva,
Here is a recursive example that might help you for your problem. Keep in mind this is just one possible solution (a loop is a much better idea though since recursion creates a bunch of calls on the stack and can often be harder to understand).
Hope this helps,
Jeff
Jeff i think you missed one small thing in your code
instead of