Minggu, 06 April 2014

Mencari Deret Fidonachi

DI  C++

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    int a,b,c,d,hasil;
a=-1;
b=1;
cout<<"\tGeneration Fibonaci"<<endl<<endl;
cout<<"Masukkan jumlah deret fibonaci = "; cin>>hasil;
cout<<endl;
for(c=1;c<=hasil; c++){
d=a+b;
cout<<d<<"\t";
a=b;
b=d;
}
cout<<endl;
    system("PAUSE");
    return EXIT_SUCCESS;
}

0 komentar:

Posting Komentar