Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void duplicare(int n, int &d)
- {
- d = 0;
- int p = 1, copie = n;
- while(n)
- {
- int c = n % 10;
- if(c % 2 == 0)
- {
- d = d + c * p;
- p = p * 10;
- d = d + c * p;
- }
- else
- d = d + c * p;
- p = p * 10;
- n = n / 10;
- }
- if(d == copie)
- d = -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement