WAP to Print fibonacci series.
#include<iostream.h>
#include<conio.h>
void main()
{ unsigned long first=0,second=1,third,n;
cout<<"Enter the limit:";
cin>>n;
cout<<" fibonacci series\n";
cout<<"first<<" "<<seecond;
for(int i=2;i<n;++i)
{ third=first+second;
cout<<" "<<third;
first=second;
second=third;
}
getch();
}
#include<conio.h>
void main()
{ unsigned long first=0,second=1,third,n;
cout<<"Enter the limit:";
cin>>n;
cout<<" fibonacci series\n";
cout<<"first<<" "<<seecond;
for(int i=2;i<n;++i)
{ third=first+second;
cout<<" "<<third;
first=second;
second=third;
}
getch();
}
Comments
Post a Comment