Advertisement
georgiu_marius04

pr1a.tema

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