Advertisement
Josif_tepe

Untitled

Dec 21st, 2024
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int n;
  6.     scanf("%d", &n);
  7.    
  8.     int zbir = 0;
  9.     while(n > 0) {
  10.         int cifra = n % 10;
  11.         n /= 10;
  12.        
  13.         if(cifra % 2 == 0) {
  14.             zbir += cifra;
  15.         }
  16.     }
  17.     printf("%d\n", zbir);
  18.    
  19.    
  20.     return 0;
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement