Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

factorial ofa number in python

# Python 3 program to find
# factorial of given number
  
# Function to find factorial of given number
def factorial(n):
       
    res = 1
      
    for i in range(2, n+1):
        res *= i
    return res
 # Driver Code
num = 5;
print("Factorial of", num, "is",
factorial(num))
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #factorial #ofa #number #python
ADD COMMENT
Topic
Name
3+4 =