easiest understandable solution in java with 100% beats ||
\n\n# Complexity\n- Time complexity:O(number of digit)\n Add your time complexity here, e.g. O(n) \n\n\n Add your space complexity here, e.g. O(n) \n\n# Code\n\
\n\n# Complexity\n- Time complexity:O(number of digit)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int subtractProductAndSum(int n) {\n        long sum=0;\n        long pro=1;\n        while(n>0)\n        {\n            sum+=n%10;\n            pro*=n%10;\n            n/=10;\n        }\n        int dff=(int) (pro-sum);\n        return dff;\n    }\n}\n```\n\n- please give vote
['Java']