1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#include<stdio.h> void main(int argc , char * argv[]) { int i,sum=0; /* if(argc!=3) { printf("you have forgot to type numbers."); exit(1); } */ printf("The sum is : "); for(i=1;i<argc;i++) sum = sum + atoi(argv[i]); printf("%d",sum); }