Factorial of a number in Python
Factorial of a number is product of all integers from 1 up to the number ( inclusive ).
Factorial of 5 is 1*2*3*4*5 = 120
n! = 1*2*3….n
Factorial of a number by using loop and by recursive functions in Python
Factorial of an input number by using loop
We used for loop here
a=int(input("Enter a number : "))
for i in range(1,a+1):
print("Factorial : ", b)
Enter a number : 6
Factorial : 720
Factorial of a number by using recursive function
By using recursive function we can call the function itself from within the function.
#print("Part factorial : ", result)
← All Sample codes
Fibonacci series »
Armstrong Number »
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.