OSDN Git Service
(root)
/
splhack
/
AndroidRuby.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
ruby-1.9.1-rc1
[splhack/AndroidRuby.git]
/
lib
/
ruby-1.9.1-rc1
/
sample
/
fact.rb
1
def fact(n)
2
return 1 if n == 0
3
f = 1
4
n.downto(1) do |i|
5
f *= i
6
end
7
return f
8
end
9
print fact(ARGV[0].to_i), "\n"