Log in to add a comment

Log in to add a comment

#include<conio.h>

void main()

{

clrscr();

unsigned long first=0,second=1,third,n;

cout<<"How many elements.(>5)\n";

cin>>n;

cout<<"Fibonacci Series:\n";

cout<<first<<" "<<second;

for(int i=2;i<n;i++)

{

third=first+second;

cout<<" "<<third;

first=second;

second=third;

}

getch();

}