Advertisement
a53

Duplicare1

a53
Jan 8th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. void duplicare(int n,int &d)
  2. {
  3. d=0;
  4. int ok=0,p=1;
  5. while(n)
  6. {
  7. d=n%10*p+d;
  8. p*=10;
  9. if(n%2==0)
  10. ++ok,d=n%10*p+d,p*=10;
  11. n/=10;
  12. }
  13. if(!ok)
  14. d=-1;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement