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.
Author: PRO1
Generation: 2026-01-25T21:40:46.879Z
© Jutge.org, 2006–2026.
https://jutge.org