A strong number is a special number whose sum of the factorial of digits is equal to the original number. For Example: 145 is a strong number. Since, 1! + 4! + 5!
from math import factorial
num=145
sum=0
for i in str(num):
sum+=factorial(int(i))
if sum==num:
print("strong number")
else:
print("Not a strong number")
Comments
Post a Comment