SHOW:
|
|
- or go back to the newest paste.
1 | #include <stdio.h> | |
2 | #include <ctype.h> | |
3 | #include <string.h> | |
4 | ||
5 | #define max 100 | |
6 | ||
7 | int main() | |
8 | { | |
9 | char c; | |
10 | int suma = 0; | |
11 | int pom; | |
12 | ||
13 | - | while((c=getchar()) != EOF) { |
13 | + | while((c=getchar()) != '\n') { |
14 | - | if(isdigit(c)) |
14 | + | if(c>=0 && c<=9) { |
15 | - | pom = atoi(c); |
15 | + | suma += atoi(c); |
16 | - | suma += pom; |
16 | + | } |
17 | } | |
18 | ||
19 | printf("%d\n", suma); | |
20 | return 0; | |
21 | } |