Advertisement
Daiana_UWU

1.c

Nov 18th, 2019
103
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 n, p=0, p2=0, c, u=1, u2=1;
  6.     cin>>n;
  7.     while (n%10!=0)
  8.     {
  9.         c=n%10;
  10.         if (c%3==0)
  11.         {
  12.             p=p+c*u;
  13.             u=u*10;
  14.         }
  15.         else
  16.         {
  17.             p2=p2+c*u2;
  18.             u2=u2*10;
  19.         }
  20.         n=n/10;
  21.     }
  22.     cout<<p<<" "<<p2;
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement