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