My Basic Solution in python.. Hope you will find it useful.. Byeee 
IntuitionAs seeing the result of the question ,for loop pop up in my mind..ApproachHowever I need to separate the digits of the number and treat them as
separat
# Intuition
As seeing the result of the question ,for loop pop up in my mind..
# Approach
However I need to separate the digits of the number and treat them as 
separate numeric values..so first I converted them as seaparate str values and then as numeric values while mathematical operations....

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->O(log(n))

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->O(1)

# Code
```python []
class Solution(object):
    def subtractProductAndSum(self, n):
        x=str(n)

        prod=1
        sum=0

        for num in x:
            prod*=int(num)
            sum+=int(num)
        return prod-sum

       
```
['Python']