#include <stdio.h> #include <stdlib.h> /* * compile: gcc -o mod.exe mod.c * run mod.exe 1 2 3 4 5 */ int main(int argc, char *argv[]) { int sum = 0, c; printf("Number of command line arguments passed: %d\n", argc); printf("Command is %s\n", argv[0]); for (c = 1; c < argc; c++) { printf("%d. Command line argument passed is %s\n", c, argv[c]); sum += atoi(argv[c]); } printf("sum = %d\n", sum); return 0; }