Created
April 15, 2022 13:49
-
-
Save OlgaEle/ffb538ef8dbd620aa26ae19d9309f8e6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| function f(n::Int64) | |
| f = 1 | |
| if n < 0 | |
| print("Factorial does not exist for negative numbers") | |
| end | |
| if n == 0 | |
| print("The factorial of 0 is 1") | |
| end | |
| if n>0 | |
| for i in 1:n | |
| f = f*i | |
| end | |
| println("The factorial is: ",f) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment