programming-examples/c++/Others/Fibonacci Series.cpp
2019-11-15 12:59:38 +01:00

25 lines
405 B
C++

Fibonacci Series
#include<iostream.h>
#include<conio.h>
main()
{
const unsigned long limit=4294967295;
unsigned long next=0;
unsigned long last=1;
long sum;
clrscr();
cout<<"\n\nThis program will print the Fibonacci series :\n\n ";
while(next<limit/2)
{
cout<<last <<" ";
sum=next+last;
next=last;
last=sum;
}
getch();
}