Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,k,i,num=0;
- vector<int>v;
- scanf("%d",&n);
- while(n!=0)
- {
- k=n%10;
- v.push_back(k);
- n/=10;
- }
- sort(v.begin(),v.end());
- int count=0,temp;
- for(i=0;i<v.size();i++)
- {
- if(v[i]==0)
- {
- count++;
- }
- }
- for(i=count;i<v.size();i++)
- {
- num=num*10;
- num+=v[i];
- if(i==count){
- num=num*int(pow(10.0,(double)count));
- }
- }
- cout<<num<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment