Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Finding factorial of a number in Python

# ___PYTHON___
# Finding factorial of a number:
userInput = int(input("Enter an integer: "))

def factorial(n):

  if n == 0 or n == 1:
    return 1

  else :
    return n * factorial(n - 1)

x = factorial(userInput)
print(x)
 
PREVIOUS NEXT
Tagged: #Finding #factorial #number #Python
ADD COMMENT
Topic
Name
6+9 =