Advertisement
Vlad020924

subiect 2019 iulie s3 2

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