- To print fibonacci series

User Input: 5

Output:

Fibonacci series : 0 1 1 2 3 5

```
#include <iostream>
using namespace std;
int main() {
int num,a=0,b=1,next;
cout<<"Enter fibonacci series nth term : ";
cin>>num;
cout<<"Your fibonacci series :";
for(int i=0; i<num; i++) {
cout<<a<<" ";
next=a+b;
a=b;
b=next;
}
return 0;
}
```

Enter fibonacci series nth term : 8 Your fibonacci series : 0 1 1 2 3 5 8 13Program

number

You should know first :

**Fibonacci Series** : Series of numbers in which each number is the sum of the last 2 numbers

```
//Initially a & b :holds 1st & 2nd terms of fibonacci series
for(int i=0; i<num; i++) {
cout<<a<<" ";
next=a+b;
a=b;
b=next;
}
```

Concept
Coming Soon !

QuickTutorial

Strength does not come from winning. Your struggles develop your strengths.