Heres' a different solution:
  def fac(num)
    return 1 if num.zero?
    1.upto(num).inject(:\*)
  end