Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.    int n, nrp=0, nri=0, Pp=1, Pi=1, c;
  8.    cin>>n;
  9.    while(n)
  10.    {
  11.        c=n%10;
  12.        if(c%2==0)
  13.        {
  14.            nrp=nrp+c*Pp;
  15.            Pp=Pp*10;
  16.        }
  17.        else
  18.        {
  19.            nri=nri+c*Pi;
  20.            Pi=Pi*10;
  21.        }
  22.        n=n/10;
  23.    }
  24.    cout<<nri<<nrp;
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement