Fibonacci Series

#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


Comments (0)

  • To add your comment please or

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.

Got It!