Advertisement
Denistod

Untitled

Nov 16th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. void duplicare(int n,int &d)
  4. {
  5. int p=1,ok=0;
  6. d=0;
  7. while(n!=0)
  8. {
  9. d=d+n%10*p;
  10. p=p*10;
  11. if(n%10%2!=0)
  12. {
  13. d=d+n%10*p;
  14. p=p*10;
  15. ok=1;
  16. }
  17. n=n/10;
  18. }
  19. if(ok==0)
  20. {
  21. d=-1;
  22. }
  23. }
  24. problema 1 2020 bac-duplicare
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement