habel's Blog

suku fibonacci

Posted on: 19 Februari 2010

uses wincrt;
var x:array[1..50] of integer;
i,n:integer;
begin
x[1]:=1;
x[2]:=1;
write(‘Anda mencari suku ke : ‘);readln(n);
write(x[1],’ ‘);
write(x[2],’ ‘);
for i:=3 to n do
begin
x[i]:=x[i-1]+x[i-2];
write(x[i],’ ‘);
end;
writeln;
writeln(‘Suku ke ‘,i,’ = ‘,x[i]);
end.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: