Java simple while
\n    public int subtractProductAndSum(int n) {\n        int sum = 0, mult = 1;\n        while (n > 0) {\n            sum += n % 10;\n            mult *= n % 10
```\n    public int subtractProductAndSum(int n) {\n        int sum = 0, mult = 1;\n        while (n > 0) {\n            sum += n % 10;\n            mult *= n % 10;\n            n /= 10;\n        }\n        return mult - sum;\n    }\n```
[]