#include int main() { FILE *input; input = fopen("./input", "r"); char inChar; char numbers[4]; numbers[2] = '\n'; numbers[3] = '\0'; int numIndex = 0; int sum = 0; while((inChar = fgetc(input)) != EOF) { if (inChar >= '0' && inChar <= '9' && numIndex == 0) { numbers[0] = inChar; numbers[1] = inChar; numIndex = 1; } else if (inChar >= '0' && inChar <= '9' && numIndex == 1) { numbers[1] = inChar; } else if (inChar == EOF || inChar == '\n' || inChar == '\0') { sum += (numbers[0] - '0') * 10 + (numbers[1] - '0'); numIndex = 0; numbers[0] = '0'; numbers[1] = '0'; } } fclose(input); printf("%d\n", sum); }