27/03/2016

Nth Term of Fibonacci Series in C++ | Nth Term

Nth Term of Fibonacci Series in C++. In mathematics, the Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterized by the fact that every number after the first two is the sum of the two preceding ones.

Fibonacci Series: 1 ,1 ,2 ,3 ,5 ,8 ,13 ,21 ,34.

Often, especially in modern usage, the sequence is extended by one more initial term.

Fibonacci Series: 0 ,1 ,1 ,2 ,3 ,5 ,8 ,13 ,21 ,34.

Nth Term of Fibonacci Series in C++


#include <iostream>
using namespace std;
int main()
{
	int range, first = 0, second = 1, fibonicci;
	cout << "Enter the Range for Terms of Fibonacci Sequence " << endl;
	cin >> range;
	cout << "Fibonacci Series upto " << range << " Terms  " << endl << 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;
}

Nth Term of Fibonacci Series Output


Nth Term of Fibonacci Series Output

Similar to the Nth Term of Fibonacci Series


Previous Post
Next Post

post written by:

3 comments:

  1. Good Work Abhi

    ReplyDelete
    Replies
    1. Great Article android based projects

      Java Training in Chennai

      Project Center in Chennai

      Java Training in Chennai

      projects for cse

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete