Skip to content
NIELITBHU

Complete Video Learning

  • Home
  • Shop
  • All Courses
  • Online Code Editor
  • Article
  • My account
Shop Now
Shop Now
NIELITBHU

Complete Video Learning

  • Home
  • Shop
  • All Courses
  • Online Code Editor
  • Article
  • My account
Using Normal Functions Fibonacci Series
Using Recursion Fibonacci Series
Advance Using Array
Using Normal Functions Fibonacci Series

#Using Normal Function for nth Fibonacci number

def fibo(n):

    a = 0
    b = 1
    if n < 0:
        print("Incorrect input")
    elif n == 0:
        return a
    elif n == 1:
        return b
    else:
        for i in range(2,n):
            c = a + b
            a = b
            b = c
        return b

  print(fibo(19))
Using Recursion Fibonacci Series

#Using Recursion Function for nth Fibonacci number

def Fibo(n):

    if n<0:
        print("Incorrect input")
    elif n==1:
        return 0
    elif n==2:
        return 1
    else:
        return Fibo(n-1)+Fibo(n-2)

print(Fibo(9))
Advance Using Array

#( Using Arrays ): creating an array in the function to find the nth number in the Fibonacci series. [0,1,1,…]  

def fib(n):
   a= [0] * (n+1)
   a[1] = 1
   for i in range (2,n+1):
       a[i] = a[i-1] + a[i-2]
   return a[n]
if __name__ == "__main__":
   print(fibonacci (int (input ("Enter the term :" ) ) ) )

  

Contribute Now

SHOW YOUR SUPPORT FOR NIELITBHU..!!
Dear reader, thank you for joining us. Readers like you are an inspiration for us to pursue NIELITBHU. We need your support or cooperation to further empower NIELITBHU and reach NIELITBHU more people in every corner of the country. Your every support is invaluable to our future.

आप हमें सहयोग जरुर करें (Contribute Now)

Don’t miss Join Our Community!

Email Id
Loading

Popular Courses

  • O Level
  • O level M1-R5 IT Tools & Basics of Networks
  • Pricing & FAQ
  • Term Conditions
  • Refund and Returns Policy
  • Privacy Policy
  • Contact
  • Our Team

Contact Info

Phone
011-29571528
Email
notification@nielitbhu.com

Copyright © 2025 NIELITBHU

Powered by New Idea Education Learning Information Technology Backbone Hacker Uptime (NIELITBHU)