#include /* C example */ #include /* for atoi */ int main(int argc, char **argv) { int n; /* not initialized until line 15 */ int i; /* not initialized until line 17 */ int sum = 0; /* This initialization is wasted effort if argc != 2. */ if (argc != 2) { fprintf(stderr, "%s: requires one command line argument\n", argv[0]); return EXIT_FAILURE; } n = atoi(argv[1]); for (i = 1; i <= n; ++i) { sum += i; /* means sum = sum + i */ } printf("The sum of the numbers from 1 to %d is %d.\n", n, sum); return EXIT_SUCCESS; }