// N + (N-1) + ... 2 + 1 // Add a loop, 0 to quit #include using namespace std; // recursive function for sum int f(int n) { if( n==0 ) return 1; else return n + f(n-1); } int main() { int N; cout << "Max: " << INT_MAX << "\n\n"; cout << "input N for computing N! - "; cin >> N; while( N != 0 ) { cout << "Sum(N) = " << f(N) << "\n\n"; cout << "input N for computing Sum(N) (0 to quit): "; cin >> N; } return 0; }