function fact (n)
if n == 0 then
return 1
else
return n * fact(n-1)
end
end
print("enter a number:")
a = io.read("*number")
print(fact(a))
키워드 : 입력, 함수, 재귀, recursive call출처 : Programming in Lua, Second Edition - 2006 - by Roberto Ierusalimschy
No comments:
Post a Comment