Simple Explained Solution using Java
\n# Simple Code Using Java\n\nclass Solution {\n    public int subtractProductAndSum(int n) {\n        int rem,prod=1,sum=0;\n        while(n!=0)\n        {\n  
\n# Simple Code Using Java\n```\nclass Solution {\n    public int subtractProductAndSum(int n) {\n        int rem,prod=1,sum=0;\n        while(n!=0)\n        {\n        rem=n%10;\n        prod=prod*rem;\n        sum=sum+rem;\n        n=n/10;\n    }\n    return prod-sum;\n}\n}\n```
['Java']