#include //C++ example #include using namespace std; int main(int argc, char **argv) { if (argc != 2) { cerr << argv[0] << ": requires one command line argument\n"; return EXIT_FAILURE; } int sum = 0; const int n = atoi(argv[1]); for (int i = 1; i <= n; ++i) { sum += i; } cout << "The sum of the numbers from 1 to " << n << " is " << sum << ".\n"; return EXIT_SUCCESS; }