1234567891011121314151617181920212223242526272829303132333435363738
#include <iostream> using namespace std; int main() { int N=10; int n; float S1; float S2; for (n = 1; n <= N; n++) { if (n % 2 == 0) { S1 += n / (n + 1); cout << "S1 is : " << S1 << endl; } if(n % 2 != 0){ S2 += -(n / (n + 1)); cout << "S2 is : " << S2 << endl; } } return 0; }