added factorial functions in Ruby and C