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