summaryrefslogtreecommitdiff
path: root/lua/test.lua
blob: d1d43d7ea05c3a916daa60788269c2e40d55cf4e (plain)
1
2
3
4
5
6
7
8
9
10
11
function factorial (i)
  if i == 0 then
    return 1
  else
    return i * factorial(i-1)
  end
end

print("number: ")
num = io.read("*number")
print(factorial(num))