C++ : Easy Solution
\nclass Solution {\npublic:\n    long long smallestNumber(long long num) {\n        long long int ans=0;\n        if(num<0)\n        { \n            long long n
```\nclass Solution {\npublic:\n    long long smallestNumber(long long num) {\n        long long int ans=0;\n        if(num<0)\n        { \n            long long n=abs(num);\n            string str=to_string(n);\n            sort(str.begin(),str.end(),greater());\n            long long k=1;\n            for(long long i=str.size()-1;i>=0;i--)\n            {\n                ans=ans+k*(str[i]-\'0\');\n                k=k*10;\n            }\n            return -1*ans;\n        }\n        else\n        {\n            long long n=abs(num);\n            string str=to_string(n);\n            sort(str.begin(),str.end());\n            long long temp=-1;\n            for(long long i=0;i<str.size();i++)\n            {\n                if(str[i]!=\'0\')\n                {\n                    temp=i;\n                    break;\n                }\n            }\n            if(temp!=-1)\n            {\n                swap(str[0],str[temp]);\n            }\n            long long k=1;\n            for(int i=str.size()-1;i>=0;i--)\n            {\n                ans=ans+k*(str[i]-\'0\');\n                k=k*10;\n            }\n            return ans;\n        }\n    }\n};\n```
['C']