Sunday, August 14, 2011

Problem 20

prob20.hs Problem 20
Filename: prob20.hs
--n! means n * (n * 1)  ...  3 * 2 * 1
--
--Find the sum of the digits in the number 100!

module Prob20
       where
         import Char

         answer = sum(map digitToInt (show(product [1..100])))


syntax highlighted by Code2HTML, v. 0.9.1

No comments:

Post a Comment