Easy Solution 0ms (100%) c++
\nclass Solution {\npublic:\n    string convertToBase7(int num) {\n        string res="";\n        bool neg=false;\n        if(num==0)return "0";\n        if(nu
```\nclass Solution {\npublic:\n    string convertToBase7(int num) {\n        string res="";\n        bool neg=false;\n        if(num==0)return "0";\n        if(num<0){\n            neg=true;\n            num=-num;\n        }\n        while(num>0){\n            int x=num%7;\n            num/=7;\n            res=to_string(x)+res;\n        }\n        if(neg)res="-"+res;\n        return res;\n    }\n};\n```
['C', 'C++']