fakultät python
def factorial(num): if num < 0: print("Factorial of negative num does not exist") elif num == 0: return 1 else: fact = 1 while(num > 1): fact *= num num -= 1 return fact num = 5; print("Factorial of",num,"is", factorial(num))
fakultät python
def factorial(num): if num < 0: print("Factorial of negative num does not exist") elif num == 0: return 1 else: fact = 1 while(num > 1): fact *= num num -= 1 return fact num = 5; print("Factorial of",num,"is", factorial(num))
fakultät python
def factorial(n): return 1 if (n==1 or n==0) else n * factorial(n - 1); num = 5; print("Factorial of",num,"is", factorial(num))
fakultät python
pythonCopydef factorial(num): if num < 0: print("Factorial of negative num does not exist") elif num == 0: return 1 else: fact = 1 while(num > 1): fact *= num num -= 1 return fact num = 5; print("Factorial of",num,"is", factorial(num))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us