Ruby Program to find factorial of a number

Program

def fact(n)
  if n == 0
    1
  else
    n * fact(n-1)
  end
end
num = ARGV[0].to_i
puts "Factorial of #{num} is #{fact(num)}"

Output

$ ruby factorial.rb 7
Factorial of 7 is 5040