You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
405 B
C++
25 lines
405 B
C++
5 years ago
|
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();
|
||
|
}
|