**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.

In mathematics, the **Fibonacci numbers** or **Fibonacci sequence** are the numbers in the following integer sequence:^{[1]}^{[2]}

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 *F _{n}* of Fibonacci numbers is defined by the recurrence relation

with seed values^{[1]}^{[2]}

or^{[3]}

The Fibonacci sequence is named after Fibonacci. His 1202 book *Liber Abaci* introduced the sequence to Western European mathematics,^{[4]}although the sequence had been described earlier in Indian mathematics.^{[5]}^{[6]}^{[7]} By modern convention, the sequence begins either with *F*_{0}Ā =Ā 0 or with *F*_{1}Ā =Ā 1. The *Liber Abaci* began the sequence with *F*_{1}Ā =Ā 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 */

#include <stdio.h>

#include <conio.h>

void main()

{

int n, first = 0, second = 1, next, c;

printf(“Enter the number of terms:”);

scanf(“%d”,&n);

printf(“First %d terms of Fibonacci series are :-\n”,n);

for ( c = 0 ; c < n ; c++ )

{

if ( c <= 1 )

next = c;

else

{

next = first + second;

first = second;

second = next;

}

printf(“%d\n”,next);

}

getch();

}

[/message_box]

[message_box title=”Output” color=”red”]

Enter the number of terms:6

First 8 terms of Fibonacci series are :-

0

1

1

2

3

5

8

13

[/message_box]

## Leave a Reply

Be the First to Comment!

You must be logged in to post a comment.

You must be logged in to post a comment.