Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3.  
  4. int main(int argc, const char * argv[]) {
  5.     int c = 'a';
  6.     int ans = 0;
  7.    
  8.     while ((c = getchar_unlocked()) != EOF) {
  9.         if (isdigit(c)) {
  10.             ans += c - '0';
  11.         }
  12.     }
  13.    
  14.     printf("%d\n", ans);
  15.    
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement