denis_andrei10

scoatereperandacifrei

Nov 19th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int p, x, nr, aux2;
  6.     cin>>x;
  7.     int(aux)=x;
  8.     aux2=x;
  9.     do
  10.     {
  11.         nr=0;
  12.         p=1;
  13.         aux2=x;
  14.         while(aux2)
  15.        {
  16.            if(aux2%10!=aux%10)
  17.         {
  18.             nr=nr+aux2%10*p;
  19.             p=p*10;
  20.         }
  21.         aux2=aux2/10;
  22.        }
  23.       cout<<nr<<' ';
  24.     aux=aux/10;
  25.     }while(aux);
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment