Advertisement
Coste_Andrei

Subpunct A

Nov 18th, 2019
103
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 x,a,r,p;
  6.     cin>>x;
  7.     p=1;
  8.     r=0;
  9.     while(x!=0)
  10.     {
  11.         a=x%10;
  12.         if(a<=5)
  13.         {
  14.             r=r+a*p;
  15.             p=p*10;
  16.         }
  17.         x=x/10;
  18.     }
  19.     cout<<r;
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement