//Fibonacci series
//program to implement fibonacci series of a number
#include<iostream.h>
void main()
{
int n,first=0,second=1,third;
cout<<"enter the number of elements=";
cin>>n;
cout<<"\n"<<first<<"  ";
cout<<second<<"  ";
for(int i=0;i<n;i++)
{
third=first+second;
cout<<third<<"  ";
first=second;
second=third;
}
}

fibonacci series is a series in which every third number is the sum of the two preceding numbers.In this program e use three numbers first,second,third.first we print the values of the first and second numbers.then we use for loop for repeatedly executing the statements i.e.we first add first and second number and store the result in third.Then we print the third variable. after this we store the value of second in first and the value of third in second and these steps are repeatedly executed .the number of terms to be displayed n is put in the conditional statement of the for loop.