Browse Source

Added factorial.py

master
depp 3 years ago
parent
commit
6d6792d3f9
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      factorial.py

+ 14
- 0
factorial.py View File

@@ -0,0 +1,14 @@
import sys

def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)

def main():
n = int(sys.argv[1])
print(factorial(n))

if __name__ == '__main__':
main()

Loading…
Cancel
Save