Fibonacci Series Algorithm and Flowchart

9
18856

Fibonacci series is defined as a sequence of numbers in which the first two numbers are 1 and 1, or 0 and 1, depending on the selected beginning point of the sequence, and each subsequent number is the sum of the previous two. So, in this series, the nth term is the sum of (n-1)th term and (n-2)th term. In this tutorial, we’re going to discuss a simple algorithm and flowchart for Fibonacci series along with a brief introduction to Fibonacci Series and some of its important properties.

Before taking you through the source code in Fibonacci Series Algorithm and Flowchart, first let me explain few things about this wonderful series, it’s mathematical derivation and properties. You can read more about Fibonacci series in our earlier post – C Program for Fibonacci Series, and here are other links to follow – Link 1. Link 2.

How to Generate Fibonacci Series?

Fibonacci Series Algorithm and Flowchart
Mathematically, the nth term of the Fibonacci series can be represented as:

               tn = tn-1 + tn-2

The Fibonacci numbers upto certain term can be represented as: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144….. or 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144….

This the major property used in algorithm and flowchart for fibonacci series. The series starts with either 0 or 1 and the sum of every subsequent term is the sum of previous two terms as follows:

Fibonacci Series Algorithm and Flowchart
First Term = 0
Second term = 1
Third Term = First + Second = 0+1 =1
Fourth term = Second + Third =1+1 = 2
Fifth Term = Third + Fourth = 2+1 = 3
Sixth Term=  Fourth + Fifth = 3+2 = 5
Seventh Term = Fifth + Sixth = 3+5 = 8
Eighth Term = Sixth + Seventh = 5+8 = 13 … and so on to infinity!

Fibonacci Series Algorithm:

  • Start
  • Declare variables i, a,b , show
  • Initialize the variables, a=0, b=1, and show =0
  • Enter the number of terms of Fibonacci series to be printed
  • Print First two terms of series
  • Use loop for the following steps
    -> show=a+b
    -> a=b
    -> b=show
    -> increase value of i each time by 1
    -> print the value of show
  • End

Fibonacci Series Flowchart:

Fibonacci Series Flowchart
Also see,
Fibonacci Series C Program
Pascal’s Triangle Algorithm/Flowchart
Tower of Hanoi Algorithm/Flowchart

The algorithm and flowchart for Fibonacci series presented here can be used to write source code for printing Fibonacci sequence in standard form in any other high level programming language. If you have any queries regarding the algorithm or flowchart, discuss them in the comments section below.

9 COMMENTS

  1. Could someone help me with this task.
    I’m unfamiliar with python code.

    Task:

    def mystery (n):
    a,b = 0,1
    while a < n:
    print (a)
    a, b = b, a+ b

    C- The function must be called using the code mystery (50). The number in brackets is passed into the variable ‘n‘when the function is called.

    Question 1
    This is not complete. The code will not run, what extra python code do I need to add to make this run on my computer?

    Question 2
    How do I make a flowchart of this?

LEAVE A REPLY

Please enter your comment!
Please enter your name here