Created
September 17, 2024 17:11
-
-
Save jesuino/c7d9c632c692ffe13f8945706f6df710 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- defines a factorial function | |
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") -- read a number | |
print(fact(a)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment