PCPOTATO
Navigation

Home
About
Contact
Resume

Projects

None yet

Categories

General
Interesting
Programming

Archives

August 2008
July 2008
June 2008
May 2008
April 2008
Project Euler #20 July 14th, 2008

n! means n (n 1) … 3 2 1. Find the sum of the digits in the number 100! The wording of this one I considered a little tricky, took me a few tries to figure out what it actually wanted.

1
2
3
4
5
6
7
8
9
10
total = 100
i = 99
while (i > 0):
    total = total * i
    i = i - 1
 
sum = 0
for d in str(total):
    sum = sum + int(d)
print sum
Leave a Reply

You must be logged in to post a comment.

Domains


Links


Presence


Meta

Log in