C++ Program to generate Fibonacci series [DEVCPP/GCC]


//Program to generate Fibonacci series

#include <iostream>

using namespace std;

int main()
{

int  i,a=0,b=1,c=0,n;
cout<<"ENTER THE NUMBER UPTO WHICH FIBONACCI SERIES IS TO BE DISPLAYED:";
cin>>n;
 
for(i=0;i<=n;i++)
{
cout<<c<<" ";
a=b;
b=c;
c=a+b;
}

return 0;
}


Share this

Related Posts

FIND US ON FACEBOOK!