Advertisement
denis_andrei10

nrmultiplede3saunu

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