//Fibonacci
series
#include<iostream.h>
#include<conio.h>
void
main()
{
clrscr();
int
a,b,i,n,c;
cout<<"Enter
number of elements:";
cin>>n;
a=0;
b=1;
c=a;
for(i=0;i<n;i++)
{
cout<<c<<"\t";
a=b;
b=c;
c=a+b;
}
getch();
No comments:
Post a Comment