Advertisement
Marchis_Tania

Bac2019_S2

Nov 11th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int rez=0,n,aux=0,ogl=0,c=0;
  6. cin>>n;
  7. aux=n;
  8. while(aux>0)
  9. {
  10. c=aux%10;
  11. if(c%2==0)
  12. {
  13. rez=rez*10+(c-1);
  14. }
  15. else
  16. {
  17. rez=rez*10+c;
  18. }
  19. aux=aux/10;
  20. }
  21. while(rez>0)
  22. {
  23. ogl=ogl*10+rez%10;
  24. rez=rez/10;
  25. }
  26. cout<<ogl;
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement