1. Fibonacci
Pseudocode
==========
Program bilangan Fibonaci
{ menentukan bilangan fibonaci}
deklarasi
int x=-1, y=1, z,a,jml
deskripsi
baca jumlah deret
for(a =1; a<=jml;a++)
{
z= x+y;
cout<<z
x=y
y=z
}
cetak deret fibonaci
Flowchart
BILANGAN FIBONANCII
#include <iostream>
#include <conio.h>
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;
getch();
}
No comments:
Post a Comment