C++ Fibonanci

#include <iostream>
#include <conio>
main()
{ int m,n,o,p,fib;
cout<<"Jumlah Angka       = "; cin>>m;
cout<<"Nilai awal         = "; cin>>n;
cout<<"selisih nilai awal = "; cin>>o;
cout<<"\nDeret Fibonacci    = "<<n;
for(int d=n;d<=m-2;d++)
{ cout<<" "<<o;
fib=n+o;
n=o;
o=fib;
}
cout<<" "<<fib;
getch();
}

0 Response to "C++ Fibonanci"

Posting Komentar