Project Euler Problem 20 Solution

n! means n x (n - 1) x ... x 3 x 2 x 1

Find the sum of the digits in the number 100!

My solution in Ruby:

sum = 0
factorial = 1
for i in 1..100
  factorial = factorial * i
end
str = factorial.to_s
y = str.scan(/./)
y.each do |c|
  sum += c.to_i
end
puts sum