📌 Java | faster than 100.00% of Java | Easy Understanding
\nclass Solution {\n    public int subtractProductAndSum(int n) {\n       \n        int sum = 0;\n        int product = 1;\n       \n        while (n!=0){\n    
```\nclass Solution {\n    public int subtractProductAndSum(int n) {\n       \n        int sum = 0;\n        int product = 1;\n       \n        while (n!=0){\n           \n            product *= n%10;\n            sum += n%10;\n            n = n/10;\n        }\n        \n        return product-sum;\n    }\n}\n```
['Java']