Menu


.

Write a program to find that entered number is Fibonacci.

#include< iostream.h >

#include< conio.h >

void main()

{

clrscr();

int a,b,c,n,i;

cout<<"Enter any number";

cin>>n;

cout<<"0"<<"\t"<<"1"<<"\t"

if(n>=1)

{

a=0;

b=1;

}

for(i=n;i!=0;i--)

{

c=b+a;

a=b;

b=c;

cout<<c<<"\t";

}

getch();

}




Enjoy our courses Today