Q.4- Write a program to input a number then check and display whether it is a spy
number or not. (A number is spy if the sum of its digits equals the product of
the digits.)
Example Consider a number 1124. Sum of digits = 1 + 1 + 2 + 4 = 8
Product of the digits = 1*1* 2 * 4 = 8
Answers
Answered by
0
n1 = int(input("Enter the number : "))
nlist = list(n1)
for i in range(len(nlist)):
nmul = i * index[i] + 1
for i in range(len(nlist)):
nadd = i+index[i]+1
if nadd == nmul:
print("its spy number")
else:
print("not spy number")
Similar questions