Very very easy solution beats 100% users in java
Intuition\n Describe your first thoughts on how to solve this problem. \nWe just extract the digit at ones place by dividing the number by 10 and then multiply 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWe just extract the digit at ones place by dividing the number by 10 and then multiply it with the product and add it to the sum, and then reduce the numbers value to n=n/10 \n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int subtractProductAndSum(int n) {\n        int sum=0;\n        int prod=1;\n        while(n>0)\n        {\n            int r=n%10;\n            prod=prod*r;\n            sum=sum+r;\n            n=n/10;\n        }\n        return prod-sum;\n    }\n}\n```
['Java']