Skip to content

Commit

Permalink
Factorial
Browse files Browse the repository at this point in the history
  • Loading branch information
getmykhan committed Jan 17, 2018
1 parent c0ed9c8 commit 40a4e03
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions factorial.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## Factorial of a number
function fac(n)
if n == 1
return 1
else
return (n * fac(n-1))
end
end

for i in 1:10
println(fac(i))
end

0 comments on commit 40a4e03

Please sign in to comment.