Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int n,c,x=0,i=1;
- cin>>n;
- do
- {
- c=n%10;
- if(c>5)
- {
- i=i/10;
- }
- else
- {
- x=x+c*i;
- }
- i=i*10;
- n=n/10;
- }
- while(n);
- cout<<x;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement