Factorial Program in Python

Find the factorial for given number using python...

Input:

Given number ( 2,3,4,5,....)

Output:

If your input number is 4
then, the output is
24.

Program:

for python 3...

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

print(fact(4))


------------------------------------------------------------------------------

Comments

Popular posts from this blog

Swap file using python

PyCon-India 2019

Addition Game using Python