Find the factorial of a given number using Python

Posted on | Sunday, 14 May 2023 | No Comments

 Given a non-negative number - N, print N!

Input Format

First and only line of input contains a number - N.

Constraints

0 <= N <= 10

Output Format

Print factorial of N.

Sample Input 0

5

Sample Output 0

120
n=int(input())
k=1
while n>0:
    k=n*k
    n=n-1
print(k)

Comments

Leave a Reply

Search

Followers