Sep-14-2020, 06:39 PM
The purpose of the code is to add the digits of the factorial product such as 5! = 120 and the output is 1 + 2 = 3.
import math
num = 10
fac = math.factorial(num)
list = []
n = 0
sum = 0
while fac > 0:
digit = (fac // 10 ** (n-1)) % 10
n += 1
list.append(digit)
for i in list:
sum+=i
break
print(sum)
