you can try like:
input = Integer(gets.chomp)
ans = 1
for i in 1..input
ans = ans*i
end
print(ans)
solved How to calculate factorial in ruby [duplicate]
you can try like:
input = Integer(gets.chomp)
ans = 1
for i in 1..input
ans = ans*i
end
print(ans)
solved How to calculate factorial in ruby [duplicate]