Friday, 26 October 2012

Program deret fibonaccy (dev-pascal)

program deret_fibonacci;
uses crt;
Var n,i,j,a,b,c,hasil : Integer;
begin
write ('Masukkan Banyaknya Deret : '); readln(n);
hasil := 2;
a:=1;
b:=1;
write (a,' ',b,' ');
For i := 1 to n-1 do
begin
for j := 1 to j do
begin
c:=a+b;
hasil := hasil + c;
write(c,' ');
a:=b;
b:=c;
end;
end;

write ('Hasil = ',hasil);
readln;
end.

Tampilan nya:

Fibonaccy

No comments:

Post a Comment