program to find fibonacci series numbers with c + +

At this time we will learn to make a program about the Fibonacci series. Previously I will tell you about the Fibonacci series.
The Fibonacci sequence was discovered by Leonardi Pisano or better known as Leonardo Fibonacci (derived from Filius Bonaccio or child of Bonaccio, the designation for the father whose real name is Guglielmo), in the 12th century in Italy. Basically, the Fibonacci series is a simple number sequence starting from 0 and 1 and the subsequent interest is the sum of the two previous numbers. Fibonacci sequence is recursive because it uses terms in the series to calculate the rate thereafter. By definition, then the tribes on the Fibonacci series is:

0 1 1 2 3 5 8 13 21 34 55 89 144 and so on.
The ratio of a pair of successive interest in the Fibonacci series will converge to an irrational number 1.618 or phi (Φ). Phi is an irrational constant value 1.61803399 … in the can from the ratio kenvergensi tribe against tribe in the Fibonacci series sbelumnya. In the Fibonacci series, a tribe is the sum of the two tribes before. Known ratio of two consecutive rate converges to a value, consider the value of the variable p. So the sequence of interest is very large, eg 3 consecutive rate is denoted as a, b, and c, then applies:
c / b = b / a = p; with c = a + b

-> (A + b) / b = b / a;
-> A ^ 2 + ab = b ^ 2;

-> A ^ 2 + ab-b ^ 2 = 0; press. quadratic

-> Then obtained a / b = (1 + √ 5) / 2 or a / b = (1 – √ 5) / 2

-> If calculated, (1 + √ 5) / 2 is equivalent to 1.618 … while (1 – √ 5) / 2 is equivalent to 0.618 …. Since a1, 618 …

Thus the number phi has properties, a number which is the number itself resiproknya minus 1. (1/phi = phi-1).

Numbers Phi is said by experts as the divine proportion or the proportion of noble or dalah term more popularly known sebagain golden ratio. Divine proportion was as if God put it into his creation to prove his greatness by the beauty of nature. There are so many examples of the appearance of golden ratio in the universe, ranging from the finger that we use for typing, outer space until there.
n                          : integer             (input)
fibbonaci             : integer             (output)
if (n = 1) or (n = 2) then
fibbonaci <= 1
fibbonaci <= fibbonaci(n-1) + fibbonaci(n-2)
The following program code in c + +:

#include <cstdlib>
#include <iostream>

using namespace std;
class fibonacci{
friend istream& operator>>(istream&, fibonacci&);
friend ostream& operator<<(ostream&, fibonacci&);
void process();
void number();
int x[100];
int a,resultl;
istream& operator>>(istream& ouut, fibonacci& s){
cout<<“get a rate :”; mlebu>>s.a;
ostream& operator<<(ostream& ouut, fibonacci& v){
ouut<<“Rate of Fibonacci :”<<v.a<<endl;
ouut<<“Row of Fibonacci :”;
for(int i=0; i<v.a; i++){

<<“Results The number of Fibonacci sequence:”<<v.result<<endl;

cout<<“\t\t<< PRINTING AND COUNTING PROGRAM Fibonacci sequence>>”<<endl;
void fibonacci::process(){
if(a==1) result=1;
else if(a==2) result=1;
for(int i=2; i<a; i++){
void fibonacci::number(){
for(int i=0; i<a; i++){
int main(int argc, char *argv[])
fibonacci x;

Above program is a program to calculate the Fibonacci sequence is by using a for loop and the selection /conditioning if .. else. And the Fibonacci sequence is oneexample of a recursive program by having the two terms arepenyetop cases and cases of a function call itself can be seen in the algorithm above.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: