Fibonacci Sequence Generator Using Array C++

By | July 11, 2019

Task: Fibonacci Sequence Generator Using Array – C++ Program

The Source Code for Fibonacci Sequence Generator Using Array

// Write a C++ program to input number of terms
// of FIBONACCI Series required, then
// display Fibonacci Terms using Array
// Author: (c)
using namespace std;
int main()
	//write program to generate FIBONACII series upto n terms using array
	int arr[100],i,n;
	cout<<"Enter Number of Fibonacci Terms required:";
	// Since first two terms are 0,1
	// use for loop to find remaining terms 
	cout<<"Required "<<n<<" Fibonaccii Terms are:"<<endl;
	for (i=0;i<n;i++)
	cout<<arr[i]<<", ";

	return 0;

Out put of the sample run of Fibonacci Terms using Array C++ Program

Enter Number of Fibonacci Terms required:10
Required 10 Fibonaccii Terms are:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34,
Process exited after 55.6 seconds with return value 0
Press any key to continue . . .


Leave a Reply

Your email address will not be published. Required fields are marked *