Posted By

chroto on 05/21/10


Tagged


Versions (?)

Project Euler - Problem 20


 / Published in: Python
 

  1. #!/usr/bin/python
  2.  
  3. # Project Euler - Problem 20
  4. import math
  5.  
  6. print "\nProject Euler - Problem 20"
  7. print " What is the sum of the digits of 100!?\n"
  8.  
  9. num = math.factorial(100)
  10. sum = 0
  11. str = str(num)
  12.  
  13. for x in str:
  14. sum += int(x)
  15.  
  16. print sum

Report this snippet  

You need to login to post a comment.