#include <iostream> using std::cin; using std::cout; const char* strAns1 = "The sum of all integers up to "; const char* strAns2 = " is "; const char* strAns3 = "\n"; int sum(int a) { if (a < 1) return 0; else return a + sum(a-1); } int main() { int n, s; cout << "Enter an integer: "; cin >> n; s = sum(n); cout << "The sum of all integers up to " << n << " is " << s << "\n"; return 0; }