1 #include <stdio.h> 2 #include <stdlib.h> 3 4 #define MAX_LEN 20 5 6 int main (void) { 7 8 int i, suma, vector[MAX_LEN], vector_end; 9 char buffer[MAX_LEN]; 10 11 vector_end = MAX_LEN; 12 for(i = 0, suma = 0; i < vector_end; i++) { 13 if(fgets(buffer, sizeof(int) + 1, stdin) != NULL) { 14 vector[i] = atoi(buffer); 15 suma += vector[i]; 16 } else { 17 vector_end = i; 18 i = MAX_LEN; 19 } 20 } 21 printf("%d\n", suma); 22 return 0; 23 }