The Fibonacci numbers or Fibonacci series or Fibonacci sequence has first two numbers equal to 1 and 0 and the further each number is consist of the addition of previous two numbers
1st number = 0
2nd number = 1
3rd number = 0+1= 1
4th number = 1+1= 2
5th number = 1+2= 3
And so on.
The Fibonacci Sequence can be written as 0,1,1,2,3,5,8,13……..
C++ Program
#include <iostream>
using namespace std;
int main() {
int range, first = 0, second = 1, fibonicci=0;
cout <> range;
cout << "Fibonicci Series upto " << range << " Terms "<< endl;
for ( int c = 0 ; c < range ; c++ ) {
if ( c <= 1 )
fibonicci = c; else {
fibonicci = first + second;
first = second;
second = fibonicci;
}
cout << fibonicci <<" ";
}
return 0;
}