Josif_tepe

Untitled

Aug 10th, 2025
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.22 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int broj;
  5.     scanf("%d", &broj);
  6.    
  7.     int tmp = broj;
  8.     int broj_na_cifri = 0;
  9.    
  10.     int paren_broj = 0;
  11.     int neparen_broj = 0;
  12.     while(tmp > 0) {
  13.         int cifra = tmp % 10;
  14.         tmp /= 10;
  15.        
  16.         if(cifra % 2 == 0) {
  17.             paren_broj = (paren_broj * 10) + cifra;
  18.         }
  19.         else {
  20.             neparen_broj = (neparen_broj * 10) + cifra;
  21.         }
  22.        
  23.         broj_na_cifri++;
  24.     }
  25.    
  26.     if(broj_na_cifri % 2 == 1) {
  27.         printf("GRESKA\n");
  28.         return 0;
  29.     }
  30.    
  31.     int paren = 0;
  32.     int neparen = 0;
  33.    
  34.     tmp = paren_broj;
  35.     while(tmp > 0) {
  36.         int cifra = tmp % 10;
  37.         tmp /= 10;
  38.        
  39.         paren = (paren * 10) + cifra;
  40.     }
  41.    
  42.     tmp = neparen_broj;
  43.     while(tmp > 0) {
  44.         int cifra = tmp % 10;
  45.         tmp /= 10;
  46.        
  47.         neparen = (neparen * 10) + cifra;
  48.     }
  49.    
  50.    
  51.     int proizvod = paren * neparen;
  52.    
  53.     int resultat = 0;
  54.     tmp = proizvod;
  55.     while(tmp > 0) {
  56.         int cifra = tmp % 10;
  57.         tmp /= 10;
  58.        
  59.         resultat = (resultat * 10) + cifra;
  60.     }
  61.    
  62.     printf("%d\n", resultat);
  63.     return 0;
  64. }
  65.  
Advertisement
Add Comment
Please, Sign In to add comment