Skip to content

Fibonacci Series is series that start with 0, followed by 1 and the next number is found by adding up the two numbers before it.

Notifications You must be signed in to change notification settings

Sagar-Sharma-7/Fibonacci_series

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Fibonacci series

What is Fibonacci Series?

The Fibonacci Series of Sequence is the series of numbers:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...

The next number is found by adding up the two numbers before it:

  • the 2 is found by adding the two numbers before it (1 + 1),
  • the 3 is found by adding the two numbers before it (1 + 3),
  • the 5 is (2 + 3),
  • and so on!

The two different ways to get fibonacci series:

import math

def factorial(n):
    for i in range(1, n + 1):
        result = ((((1 + math.sqrt(5))/2)**(i-1)) - (((1- math.sqrt(5))/2)**(i - 1))) / math.sqrt(5)
        print(int(result), end=" , ")


n = int(input("Enter number of terms term: "))
factorial(n)

def fibonacci(n):
    first = 0
    second = 1
    print(first)
    print(second)
    for i in range(1, n):
        third = first + second
        print(third)
        first, second = second, third

n = int(input("Enter nth term: "))
fibonacci(n)


Editor and Language used:

vscode python


ForTheBadge built-with-love ForTheBadge makes-people-smile

License: MIT Follower

alttext

About

Fibonacci Series is series that start with 0, followed by 1 and the next number is found by adding up the two numbers before it.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages