A series in which each number is the sum of preceding two numbers is called Fibonacci series.

For example: 0 1 1 2 3 5 8 13 . . . . .

Below is the program to find fibonacci series in C++.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#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