Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Program to display first n terms of fibonacci series.
- #include<iostream.h>
- #include<conio.h>
- void main()
- {
- clrscr();
- long a,b=0,c=1,d=1;
- cout<<"Enter the number of terms of fibnoacci series to display: ";
- cin>>a;
- cout<<"The first "<<a<<" terms of fibonacci series are: "<<endl;
- for(int i=0;i<=a;i++)
- {
- d=b+c;
- b=c;
- c=d;
- cout<<d<<" ";
- }
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment