Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- int
- main(void)
- {
- enum { CODE_ZERO = 48 };
- unsigned int sum = 0;
- int ch;
- do {
- ch = getchar_unlocked();
- if(isdigit(ch)) {
- sum += ch - CODE_ZERO;
- }
- } while(ch != EOF);
- printf("%u\n", sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement