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