Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.31 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <inttypes.h>
  3. #include <ctype.h>
  4.  
  5. int main()
  6. {
  7.     char c;
  8.     int64_t sum = 0;
  9.     while (scanf("%c", &c) == 1)
  10.     {
  11.         if (isdigit(c))
  12.         {
  13.             int a = (int)c - 48;
  14.             sum += a;
  15.         }
  16.     }
  17.     printf("%ld" "\n", sum);
  18.    
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement