Jun 1, 2013

Deret Bilangan Fibonacci Pada C++

  No comments

SCRIPT CODE

/*
Agung Pambudi (c) 2013
( afh4mz@gmail.com )

Date: 1-06-2013
Description: Program menampilkan deret bilangan Fibonacci
*/

#include <iostream>
using namespace std;

main()
{
    int x=-1, y=1, z, a, jml;
    cout<< "Jumlah deret Fibonacci = "; cin>> jml;
    cout<< "Deret Fibonacci = \n";
    for(a=1 ; a<=jml; a++)
    {
        z=x+y;
        cout<< z <<ends;
        x=y;
        y=z;
    }
    cout<< endl;
}
//END

Sekian, semoga bermanfaat :)

No comments :

Post a Comment

What do you want? Just leave a comment :)

*choose an emoticon below