box-o-sand/round0/fact.rb

20 lines
193 B
Ruby
Raw Normal View History

2009-06-12 01:27:47 +00:00
# factorializer!
def fact(n)
if n == 0
return 1
else
return n * fact(n - 1)
end
end
def main()
puts fact(ARGV[0].to_i)
end
if __FILE__ == $0
main()
end