CPP04 – (c) Write a CPP program to generate a Fibonacci series of 50 numbers .

By | October 17, 2018

(c) Write a CPP program to generate a Fibonacci series of 50 numbers .

CODE:-

#include<iostream.h>
#include<conio.h>
void main()
{
unsigned long T,i,X=0,Y=1;
clrscr();
cout<<“\nFIBONACCI 50 SERIES ARE :- \n”;
i=0;
while(i<50)
{
T=X+Y;
cout<<” “<<X;
X=Y;
Y=T;

i++;
}
getch();
}

#include<iostream.h>
#include<conio.h>
void main()
{
unsigned long T,i,X=0,Y=1;
clrscr();
cout<<"\nFIBONACCI 50 SERIES ARE :- \n";
i=0;
while(i<50)
{
T=X+Y;
cout<<" "<<X;
X=Y;
Y=T;
i++;
}
getch();
}

SCREEN SHOTS:-

OUTPUT:-