Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python 3 program to find factorial of given number

# Python 3 program to find
# factorial of given number
def factorial(n):
     
    # single line to find factorial
    return 1 if (n==1 or n==0) else n * factorial(n - 1)
 
# Driver Code
num = 5;
print("Factorial of",num,"is",
factorial(num))
 
# This code is contributed by Smitha Dinesh Semwal
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Python #program #find #factorial #number
ADD COMMENT
Topic
Name
2+1 =