Advertisement
Daiana_UWU

1.a

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