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
Math,
2 months ago
English,
2 months ago
India Languages,
2 months ago
English,
4 months ago
Social Sciences,
4 months ago
Science,
9 months ago