Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- void cifre(int n, int &imp, int &p)
- {
- if (n < 10)
- {
- if (n%2)
- {
- imp = n;
- p = 0;
- }
- else
- {
- imp = 0;
- p = n;
- }
- }
- else
- {
- cifre(n/10,imp,p);
- if ((n%10)%2)
- imp = imp * 10 + n % 10;
- else
- p = p * 10 + n % 10;
- }
- }
- int main ()
- {
- int imp = 0,p = 0;
- int n=123456;
- cifre(n,imp,p);
- cout<<imp<<' '<<p;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement