0 like 0 dislike
in Examples, Exercises and Projects by (7k points)

A number in which the sum of factorial of individual digits is equal to the number is called strong number.

For example, 145 is a strong number because 145=(!1)+(!4)+(!5)=1+24+120=145

1 Answer

0 like 0 dislike
by (7k points)
selected by
 
Best answer

a=int(input())

a=str(a)

b=0

for i in range(len(a)):

    num=int(a[i])

    factorial=1

    for j in range(1,num+1):

        factorial=factorial*j

    b=b+factorial

if b==int(a):

    print("Given number is strongest number")

else:

    print("Given number is not strongest number")

Register fast for winter training program at Goeduhub Technologies. We are providing winter training in AI-ML, IoT, Python, Hadoop and PLC-SCADA.

[[ CALL - 07976731765 ]]

...