As per the title, I’ve been given this task to solve. While it is easy to do this using a traditional loop, I am still lost on how this could be achieved using recursion. Any help regarding this will be appreciated!
Here are the expected results:
Input: 4 Output: 4 Explanation: 1 + 2 - 3 + 4 = 4 Input 9 Output: -3 Explanation: 1 + 2 - 3 + 4 - 5 + 6 - 7 + 8 - 9 = -3
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.