similar Java,C,C++,C# easy solution 100% 0ms
\nclass Solution {\n    public int subtractProductAndSum(int n) {\n\n        int sum = 0;\n        int product = 1;\n\n        while (n > 0) {\n            int 
```\nclass Solution {\n    public int subtractProductAndSum(int n) {\n\n        int sum = 0;\n        int product = 1;\n\n        while (n > 0) {\n            int temp = n % 10; // for example  n = 1223 then after n % 10 we get last digit \'3\'\n            sum += temp; // (sum = sum + temp;) so then sum = 0 + 3 => sum = 3; \n            product *= temp;// (product = product * temp;) product = 1 * 3 => 3;\n            n /= 10; // (n = n / 10;) then we divide n = 1223 / 10 => 122, n = 122\n        }\n\n        return product - sum;\n    }\n}\n```\n
['C', 'Python', 'Java']