Fibonacci series in C programming: C program for Fibonacci series without and with recursion. Using the code below you can print as many numbers of terms of series as desired. Numbers of Fibonacci sequence are known as Fibonacci numbers. First few numbers of series are 0, 1, 1, 2, 3, 5, 8 etc, Except first two terms in sequence every other term is the sum of two previous terms, For example 8 = 3 + 5 (addition of 3, 5). This sequence has many applications in mathematics and Computer Science.
or (often, in modern usage):
By definition, the first two numbers in the Fibonacci sequence are 1 and 1, or 0 and 1, depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two.
In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation
The Fibonacci sequence is named after Fibonacci. His 1202 book Liber Abaci introduced the sequence to Western European mathematics,although the sequence had been described earlier in Indian mathematics. By modern convention, the sequence begins either with F0 = 0 or with F1 = 1. The Liber Abaci began the sequence with F1 = 1, without an initial 0.
[message_box title=”Program ” color=”red”]
/* Write a program to calculate Fibonacci series */
/* Written by Utpal Chaudhary */
/*Student of L.D COLEGE OF ENGINEERING,Ahmedabad-15,Gujarat */
int n, first = 0, second = 1, next, c;
printf(“Enter the number of terms:”);
printf(“First %d terms of Fibonacci series are :-\n”,n);
for ( c = 0 ; c < n ; c++ )
if ( c <= 1 )
next = c;
next = first + second;
first = second;
second = next;
[message_box title=”Output” color=”red”]
Enter the number of terms:6
First 8 terms of Fibonacci series are :-