Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  
  7. int br;
  8. int niz[10];
  9. int brParCif = 0;
  10. cout << "Unesite broj: ";
  11. cin >> br;
  12. int br2 = br;
  13. while (br2 != 0)
  14. {
  15. if ((br2 % 10) % 2 == 0)
  16. {
  17. niz[brParCif] = (br2 % 10);
  18. brParCif++;
  19. }
  20. br2 /= 10;
  21. }
  22.  
  23. for (int i = 0; i < brParCif; i++)
  24. {
  25. for (int j = 0; j < brParCif; j++)
  26. {
  27. if (niz[i] < niz[j])
  28. {
  29. int temp = niz[i];
  30. niz[i] = niz[j];
  31. niz[j] = temp;
  32. }
  33. }
  34. }
  35.  
  36. for (int i = 0; i < brParCif; i++)
  37. cout << niz[i];
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement