Fibonacci series starts with 0 and 1.The third element of fibonacci series in obtained by adding the first,two elements of the series.If we need to find an element of the series we add the two numbers which are just behind it.We can generalize the equation as,the nth element of the series is obtained by adding n-1 and n-22,1 element of the series.

Let us see an example…..As we know the first two elements are 0 and 1.The third element of the series is obtained by adding 0 and 1,hence the third element is 0+1=1.Therefore the series would be 0,1,1…Fourth element of the series is addition of second and third element….i.e 1+1=2..hence the fourth element is 2 and series will be 0,1,1,2….

By observing the program we need to change the values of a and b repeatedly…..because we need to add two values behind to it.In the below program the input is an integer which is length of the series.

#include<stdio.h>
#include<conio.h>
void main()
{
int a=0,b=1,c,i,n;
clrscr();
printf("\t\t*********Fibonnaci series************");
printf("\nEnter number of terms need to be present in the series:");
scanf("%d",&n);
printf("\n%d %d ",a,b);
for(i=0;i<n-2;i++)
{
c = a+b;
printf("%d ",c);
a=b;
b=c;
}
getch();
}

**Output:**

Download the source code.

### Like this:

Like Loading...

*Related*

## About Anuroop D

Very enthusiastic about technology and likes to share my knowledge through blogging. Has Bachelor's in Information Technology and currently pursuing my Master's in Computer Science.