A series of numbers in which each number ( Fibonacci number ) is the sum of the two preceding numbers. The simplest is the series 1, 1, 2, 3, 5, 8, etc.Here is the C++ code which will find the Fibonacci of a Number.
Source Code
#include<iostream> using namespace std; int main () { cout<<"\t \t \t LEP Tutorials \n\n\n"; int num,sum; long previous =1,next =0; cout<<"Enter Number to Find Fibonacci Series : "; cin>>num; while (next < num/2) { cout<<previous<<" "; sum = previous + next; next = previous ; previous = sum; } }
0 comments:
Post a Comment