Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. import random
  2.  
  3. def Factorial(n):
  4.     if n<2:
  5.         return 1
  6.     return n*Factorial(n-1)
  7. def FactorialTest(n,x):
  8.     i = 0
  9.     while i<x:
  10.         print("  ",end="")
  11.         i+=1
  12.     print("n = ",n)
  13.     if n<2:
  14.         return 1
  15.     return n*FactorialTest(n-1,x+1)
  16.  
  17. def FactoriaLux(n):
  18.     return n*FactorialTest(n,0)
  19. def Fibbo(n):
  20.     if n<3:
  21.         return 1
  22.     return Fibbo(n-1) + Fibbo(n-2)
  23. def Fibbo1(n):
  24.     if n<3:
  25.         return 1
  26.     return Fibbo1(n-1) + Fibbo1(n-2)
  27. def Main():
  28.     n = int(input("n? = "))
  29.     print("%d! = %d"%(n,FactoriaLux(n)))
  30.     print("Fibbo(%d) = %d"%(n,Fibbo(n)))
  31. Main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement