Skip to content

Commit

Permalink
Some directories had a capital in their name [fixed]. Added a recursi…
Browse files Browse the repository at this point in the history
…ve factorial algorithm. (TheAlgorithms#763)

* Renaming directories
* Adding a recursive factorial algorithm
  • Loading branch information
vysor authored and poyea committed Apr 22, 2019
1 parent 48bba49 commit df04d94
Show file tree
Hide file tree
Showing 36 changed files with 13 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions maths/factorial_recursive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def fact(n):
"""
Return 1, if n is 1 or below,
otherwise, return n * fact(n-1).
"""
return 1 if n <= 1 else n * fact(n-1)

"""
Shown factorial for i,
where i ranges from 1 to 20.
"""
for i in range(1,21):
print(i, ": ", fact(i), sep='')
File renamed without changes.

0 comments on commit df04d94

Please sign in to comment.