mirror of
https://github.com/correl/euler.git
synced 2024-11-27 11:09:54 +00:00
15 lines
No EOL
283 B
Python
15 lines
No EOL
283 B
Python
# Could use math.factorial, but that takes the fun out of it, doesn it
|
|
def factorial(n):
|
|
f = n
|
|
i = n - 1
|
|
while i > 1:
|
|
f = f * i
|
|
i = i - 1
|
|
return f
|
|
|
|
f = str(factorial(100))
|
|
sum = 0
|
|
for c in f:
|
|
sum = sum + int(c)
|
|
|
|
print 'Sum of digits in 100!:', sum |