1998-01-16 15:13:05 +03:00
|
|
|
def fact(n)
|
1998-01-16 15:19:22 +03:00
|
|
|
return 1 if n == 0
|
|
|
|
f = 1
|
2002-12-19 23:42:50 +03:00
|
|
|
n.downto(1) do |i|
|
|
|
|
f *= i
|
1998-01-16 15:13:05 +03:00
|
|
|
end
|
1998-01-16 15:19:22 +03:00
|
|
|
return f
|
1998-01-16 15:13:05 +03:00
|
|
|
end
|
|
|
|
print fact(ARGV[0].to_i), "\n"
|