blob: ce0f01fc4a1c09716567f2f7f157f6304c42fd25 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <stdio.h>
#include <stdlib.h>
int main (void) {
int c = getchar();
int prev = -1;
int sum = 0;
while (!ferror(stdin) && !feof(stdin)) {
if (c == '\n') {
sum += prev;
prev = -1;
}
if (c <= '9' && c >= '0') {
if (prev == -1)
sum += 10*(c-'0');
prev = c-'0';
}
c = getchar();
}
printf("%d\n", sum);
}
|