Factorial Number Program in Python

  

         Factorial Number Program in Python

Factorial of n is the product of all positive descending integers. Factorial of n is denoted by n!. For example:

  1. 5! = 5*4*3*2*1 = 120  
  2. 3! = 3*2*1 = 6  


Program:

n=int(input("Enter the number"));       
f=1
for i in range(1,n+1,1):
           f=f*i   
       
print("Factorial of",n," is ",f);     



OutPut:
Enter the number5
Factorial of 5  is  120

Enter the number3
Factorial of 3  is  6






No comments:

Post a Comment