You are on page 1of 2

Fibonacci Series Algorithm and Flowchart

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.
How to Generate Fibonacci Series?
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….
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:
Source Code in C Program for Fibonacci Series without using Function

/*C Program for Fibonacci Series without using Function*/


#include <stdio.h>
int main()
{
int i, n, a=0, b=1, show=0;
printf("\nEnter number of terms required in Fibonacci Series: ");
scanf("%d",&n);
printf("\nThe Fibonacci Series is:\n\n\n %d+%d+", a, b);
/* Showing the first two term of the Fibonacci Series */
i=2;
/* i=2, since the first two terms of the series have already been shown*/
while (i<n)
{
show=a+b;
a=b;
b=show;
++i;
printf("%d+",show);
}
return 0;
}

You might also like