How to find factorial of a number:-
we can find factorial of a number by multiplying from 1 to that number.
ex:- 5!= 1*2*3*4*5=120
3!=1*2*3=6
code:-
num=int(input("enter a number"))
fact=1
for i in range(1,num+1):
fact=fact*i
print("Factorail of the number is: ",fact)
Output:-
enter a number5
Factorail of the number is: 120
0 Comments