fact={}
def factorial(n):
fact[0]=1
fact[1]=1
if n==0 and n==1:
return 1
else:
for i in range(2,n+1):
fact[i]=i*fact[i-1]
return fact[n]
num=int(input("Enter number to find factorial : "))
print("Factorial of ",num," is ",factorial(num))
print("The values")
print(fact)
Showing posts with label Python program to find factorial. Show all posts
Showing posts with label Python program to find factorial. Show all posts
Tuesday, 28 November 2017
Python Program to Find Factorial
Subscribe to:
Posts (Atom)
Python Program to find Fabonacci
fabtab={} def fabonacci(n): fabtab[0]=0 fabtab[1]=1 for i in range(2,n+1): fabtab[i]=fabtab[i-1]+fabtab[i-2] ...
-
#include< iostream > #include< conio.h > #include< math.h > using namespace std; int Octal_to_Decimal(long n) { ...
-
#include< iostream > #include< conio.h > #include< math.h > using namespace std; int Octal_to_Binary(long n) { ...
-
#include iostream > #include conio.h > using namespace std; int main() { float lenght, breath; doubl...
