Advertisement
Josif_tepe

Untitled

Apr 11th, 2023
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.    
  6.     int broj;
  7.     cin >> broj;
  8.    
  9.     int nov_broj = 0;
  10.    
  11.     while(broj > 0) {
  12.         int cifra = broj % 10;
  13.        
  14.         if(cifra % 2 == 1) { // ako e neparna
  15.             nov_broj = (nov_broj * 10) + cifra;
  16.         }
  17.        
  18.         broj /= 10;
  19.     }
  20.     cout << nov_broj << endl;
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement