Fibonacci Series

C++ Programming

C++ Programming Examples

#include<iostream>
using namespace std;

int main() {
	int a = 0, b = 1, temp, no;
	cout << "Program for Fibonacci Series" << endl;
	cout << "Enter a Number:" << endl;
	cin >> no;

	/* Loop the process using "While Loop" */
	while(b < no) {
		cout << b << endl;
		temp = a + b;
		a = b;
		b = temp;
	}

	return 0;
}


          /****** Output ******/
          

Program for Fibonacci Series


Enter a number:


50




Fibonacci Series -


1


1


2


3


5


8


13


21


34

Learn more about Fibonacci series