Implement a RECURSIVE function that, given a positive natural , returns the simple altenated sum . This is the header:
// Pre: n >= 1
// Post: Returns 1-2+3-4+...+(-1)^(n+1)*n
int simpleAlternatedSum(int n);
You only need to submit the required procedure; your main program will be ignored.
Note that we are requesting a RECURSIVE
solution.
simpleAlternatedSum(1) = 1 simpleAlternatedSum(5) = 3 simpleAlternatedSum(10) = -5 simpleAlternatedSum(533) = 267