I have just been studying the concept of recursion and I thought that I would try a simple example. In the following code, I am attempting to take the numbers: 1, 2, 3, 4, 5, an
You're returning 1 in the else clause. You should be returning 0:
else { return 0; }
If the value is not greater than zero, why would you return one in the first place?