PROGRAAM ON FIBONAACI SERIES
#include<iostream.h>
#include<conio.h>
void main()
{
unsigned long first=0,second=1,third,n;
clrscr();
cout<<"Enter the limit:";
cin>>n;
cout<<"Fibonaaci Series: ";
cout<<first<<" "<<second;
for(int i=2;i<n;i++)
{
third=first+second;
cout<<" "<<third;
first=second;
second=third;
}
getch();
}
#include<conio.h>
void main()
{
unsigned long first=0,second=1,third,n;
clrscr();
cout<<"Enter the limit:";
cin>>n;
cout<<"Fibonaaci Series: ";
cout<<first<<" "<<second;
for(int i=2;i<n;i++)
{
third=first+second;
cout<<" "<<third;
first=second;
second=third;
}
getch();
}
Comments
Post a Comment