Skip to content

Instantly share code, notes, and snippets.

@OlgaEle
Created April 15, 2022 13:49
Show Gist options
  • Select an option

  • Save OlgaEle/ffb538ef8dbd620aa26ae19d9309f8e6 to your computer and use it in GitHub Desktop.

Select an option

Save OlgaEle/ffb538ef8dbd620aa26ae19d9309f8e6 to your computer and use it in GitHub Desktop.
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