A series in which each number is the sum of the preceding two numbers is called the Fibonacci series.
For example 0 1 1 2 3 5 8 13 . . . . .
Below is the program to find Fibonacci series in C++.
#include<iostream>
using namespace std;
int main()
{
long n,first=0,second=1,third;
cout<<"How many numbers?";
cin>>n;
cout<<"Fibonacci series\n"<<first<<" "<<second;
for(int i=2;i<n;++i)
{
third=first+second;
cout<<" "<<third;
first=second;
second=third;
}
return 0;
}
Output:
How many numbers?5
Fibonacci series
0 1 1 2 3
SIR CAN U PLEASE TELL ME THE DRY RUNNING OF FIBOASSI SERIES. I AM A LITTLE BIT IN PORBLEM.
Its usefull