Skip to content

Commit

Permalink
problem 20
Browse files Browse the repository at this point in the history
  • Loading branch information
twymer committed Jun 1, 2011
1 parent 767a981 commit e1dbb1e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ruby/p20.rb
@@ -0,0 +1,6 @@
# Problem 20
# I really like using inject..

n = 100
factorial = (1..n).inject(:*)
puts factorial.to_s.split(//).inject(0) { |sum, char| sum + char.to_i }

0 comments on commit e1dbb1e

Please sign in to comment.