euler/020.rb
Yann Esposito (Yogsototh) 198b8d0fd3 Initial submit
2011-05-31 17:31:13 +02:00

6 lines
141 B
Ruby

def fact(x)
return 1 if x<=1
return x*fact(x-1)
end
puts fact(100).to_s.split("").collect! { |x| x.to_i }.inject(0) {|sum,v| sum+v}