Simple C++ Solution for newbie | C++
This is a very basic approach and efficient using C++.\n\nclass Solution {\npublic:\n    int subtractProductAndSum(int n,int sum = 0,int prod = 1) {\n        wh
This is a very basic approach and efficient using **C++**.\n```\nclass Solution {\npublic:\n    int subtractProductAndSum(int n,int sum = 0,int prod = 1) {\n        while(n>0)\n        {\n            prod*=n%10;\n            sum+=n%10;\n            n/=10;\n        }\n        return prod-sum;\n    }\n};\n```
[]