Skip to content

Instantly share code, notes, and snippets.

@Manume
Last active August 29, 2015 14:01
Show Gist options
  • Save Manume/4f96660d7d46d7460ad2 to your computer and use it in GitHub Desktop.
Save Manume/4f96660d7d46d7460ad2 to your computer and use it in GitHub Desktop.
programs for printing fibonacci series
#include <iostream.h>
#include <conio.h>
void main()
{
clrscr();
int a,b,x,y,num1,ct;
a=0;
b=1;
cout << "Enter the number of terms (less than 25) : " << endl;
cin>>num1;
cout << a << endl;
cout << b << endl;
for(ct=1;ct<=num1-2;ct++)
{
x=a+b;
cout << x << endl;
y=a;
a=b;
b=x;
}
getch();
}
sampie input and output
input
12
output
0
1
1
2
3
5
8
13
21
34
55
89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment