Fibonacci series

Fibonacci Series

Fibonacci series is a series whose nth term is the summation of (n-1)th and (n-2)th term.
   F(n)=F(n-1)+F(n-2)
e.g 0,1,1,2,3,5,8,...
We can use Python code to get Fibonacci series's nth term



def fib(n):

if(n==1):

return 0

elif(n==2):

return 1

else:

return fib(n-1)+fib(n-2)



print(fib(5))

output 3




I LOVE $$E=MC^2$$

Comments