C++ solution (100% better)
\nclass Solution {\npublic:\n    int subtractProductAndSum(int n) {\n        string num = to_string(n);\n        int mult,add,solution;\n        mult=1;\n      
```\nclass Solution {\npublic:\n    int subtractProductAndSum(int n) {\n        string num = to_string(n);\n        int mult,add,solution;\n        mult=1;\n        add=0;\n        solution=0;\n        for(int i = 0; i<num.length();i++)\n        {\n            mult*=(num[i]-\'0\');\n            add+=(num[i]-\'0\');\n        }\n        solution = mult-add;\n        return solution;\n    }\n};\n```
[]