18 lines
303 B
C
18 lines
303 B
C
#include <stdio.h>
|
|
|
|
int main(int argc, char **argv) {
|
|
int buf;
|
|
int acc;
|
|
int err;
|
|
for(int i=1;i<argc;i++) {
|
|
err=sscanf(argv[i], "%i", &buf);
|
|
if(err!=1) {
|
|
fprintf(stderr, "sscanf error: not an integer.\n");
|
|
return 1;
|
|
}
|
|
acc+=buf;
|
|
}
|
|
printf("%d\n",acc);
|
|
return 0;
|
|
}
|