C++ Program to Print a Fibonacci series

      No Comments on C++ Program to Print a Fibonacci series
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x=0,y=1,z,i,n;
cout<<"Enter no. of digits you want to find fibonacci series:-\n";
cin>>z;
cout<<"Fibonacci series is:-"<<endl;
for(i=0;i<=z;i++)
{
 cout<<" "<<x;
 n=x+y;
 x=y;
 y=n;
}
 getch();
}

OUTPPUT:-

Leave a Reply

Your email address will not be published. Required fields are marked *