#include using namespace std; double series(int n); double series(int n) { if (n <= 0) return 0; else return (double) (n/(2.0*n+1.0)) + series(n-1); } int main(int argc, const char *argv[]) { long x; cout << "enter a number to see the sum of the series (negative to quit)" << endl; do { cout << ">> "; cin >> x; if (x >= 0) cout << "series(" << x << ") = " << series(x) << endl; } while (x >= 0); return 0; }