Sample Input: Enter a number 123
1+2+3= 1*2*3
Sample Output: It is a sum-Product number.
Answers
Answered by
1
import math
def sum_prod_num(num):
digits = [int(n) for n in str(num)]
if sum(digits) == math.prod(digits):
return "It is a sum-Product number"
return "It is not a sum-Product number"
n = int(input("enter num: "))
print(sum_prod_num(n))
Similar questions