Generate Fibonacci Series for N numbers
Write a C++ Program to Generate Fibonacci Series for N numbers. Here’s simple Program to Generate Fibonacci Series for N numbers in C++ Programming Language.
Fibonacci Series is in the form of 0, 1, 1, 2, 3, 5, 8, 13, 21,…… To find this series we add two previous terms/digits and get next term/number.
Here is source code of the C++ Program to Generate Fibonacci Series for N numbers. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.
SOURCE CODE : :
/* C++ Program to Generate Fibonacci Series for N numbers */ #include<iostream> using namespace std; int main() { int i,no, first=0, second=1, next; first=0; second=1; cout<<"How many terms u want to Display :: "; cin>>no; cout<<"\nThe Fibonacci series for [ "<<no<<" ] terms are :: \n\n"; for(i=0; i<no; i++) { cout<<" "<<first<<" "; next = first + second; first = second; second = next; } cout<<"\n"; return 0; }
Output : :
/* C++ Program to Generate Fibonacci Series for N numbers */ How many terms u want to Display :: 8 The Fibonacci series for [ 8 ] terms are :: 0 1 1 2 3 5 8 13 Process returned 0
Above is the source code for C++ Program to Generate FibonacciSeries for N numbers which is successfully compiled and run on Windows System.The Output of the program is shown above .
If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.
Thanks for reading the post….