formations/algo/poo/cours/code/factorielle.py
2019-03-25 13:14:17 +01:00

13 lines
230 B
Python

def factorielle(n):
if (n > 1):
r = n*factorielle(n-1)
else:
r = 1
return r
def print_fact(n):
print "factorielle {} = {}\n".format(5, factorielle(5))
if __name__ == '__main__':
print_fact(5)