formations/algorithmique/cours/code/factorielle.py
2017-04-06 16:57:22 +02: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)