#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n, first , second , third;
cout<<"/////////////////fibonacci series////////////////////";
cout<<"\n enter the number of terms in series you want";
cin>>n;
first=1;
second=1;
cout<<first<<"\t"<<second<<"\t";
for(int i=3;i<=n;i++)
{
third=first+second;
cout<<third<<"\t";
first=second;
second=third;
}
getch();
}
#include<conio.h>
void main()
{
clrscr();
int n, first , second , third;
cout<<"/////////////////fibonacci series////////////////////";
cout<<"\n enter the number of terms in series you want";
cin>>n;
first=1;
second=1;
cout<<first<<"\t"<<second<<"\t";
for(int i=3;i<=n;i++)
{
third=first+second;
cout<<third<<"\t";
first=second;
second=third;
}
getch();
}
No comments:
Post a Comment