Advertisement
amermo

Test

Mar 3rd, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. void funkcija(int n, int parni, int neparni)
  4. {
  5.     int mojbroj(n), desetica1(1), desetica2(1);
  6.     while(mojbroj > 0)
  7.     {
  8.         int cifra(mojbroj % 10);
  9.         if(cifra % 2 == 0)
  10.         {
  11.             parni+=cifra*desetica1;
  12.             desetica1*=10;
  13.         }
  14.         else
  15.         {
  16.             neparni+=cifra*desetica2;
  17.             desetica2*=10;
  18.         }
  19.         mojbroj/=10;
  20.     }
  21.     std::cout << parni << std::endl << neparni << std::endl;
  22. }
  23.  
  24. int main()
  25. {
  26.     funkcija(32564719, 0, 0);
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement