Josif_tepe

Untitled

Aug 9th, 2025
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(){
  4.        
  5.     int x;
  6.     scanf("%d", &x);
  7.    
  8.     int zbir = 0;
  9.     int proizvod = 1;
  10.    
  11.     for(int i = x; i > 0; i /= 10) {
  12.         int cifra = i % 10;
  13.        
  14.         if(cifra % 2 == 0) {
  15.             zbir += cifra;
  16.         }
  17.         else {
  18.             proizvod *= cifra;
  19.         }
  20.     }
  21.    
  22.     printf("%d\n", zbir);
  23.     printf("%d\n", proizvod);
  24.    
  25.    
  26.     return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment