Advertisement
nicuvlad76

Untitled

Nov 25th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() ///1234 13 24
  4. {
  5. int n, a,pa, b, pb, c;
  6. a=0 ;
  7. pa=1; ///cifrele impare
  8. b=0;
  9. pb=1; ///cifrele pare
  10. cin>>n;
  11. while(n!=0)
  12. {
  13. c=n%10;
  14. n=n/10;
  15. if(c%2==1)
  16. {
  17. a=a+pa*c;
  18. pa*=10;
  19. }
  20. else
  21. {
  22. b=b+pb*c;
  23. pb*=10;
  24. }
  25. }
  26. cout<<a<<' '<<b;
  27. return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement