Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
# function to find factorial
def factorial (n):
if (n <= 1):
return 1
i = 1
product = 1
while (i <= n):
product = product * i
i = i + 1
return product
# main() function
print(factorial(0))
print(factorial(1))
print(factorial(2))
print(factorial(8))
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more