Advertisement
MinhNGUYEN2k4

Untitled

Nov 23rd, 2021
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #define _CRT_NONSTDC_NO_DEPRECATE
  3. #include <stdio.h>
  4. #include <ctype.h>
  5. #include <string.h>
  6. #include <math.h>
  7. #include <stdlib.h>
  8. #include <stdbool.h>
  9. #include <limits.h>
  10. #include <time.h>
  11. #include <stddef.h>
  12. #include <float.h>
  13.  
  14. #define N 10005
  15. #define PI 3.14
  16.  
  17. int main()
  18. {
  19.     int tcase; 
  20.  
  21.     scanf("%d", &tcase);
  22.  
  23.     while (tcase--)
  24.     {
  25.         unsigned long long sum = 0;
  26.         unsigned long long n;
  27.  
  28.         scanf("%llu", &n);
  29.  
  30.         while (n != 0)
  31.         {
  32.             if ((n % 10) % 2 == 0)
  33.             {
  34.                 sum += n % 10;
  35.             }
  36.             n /= 10;
  37.         }
  38.  
  39.         printf("%d\n", sum);
  40.     }
  41.  
  42.     return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement