program deret fibonacci

Membuat deret fibonacci dengan menggunakan bahasa pemrograman PASCAL

program deretfibonacci;
uses wincrt;

var
i,penambah,suku : integer;
deret : array[1..100] as integer;

begin
read(suku);
for i = 1 to suku do
if i = 1 then
begin
deret[i] = 1;
penambah = 0

end

else
begin
deret [i] = deret[i-1] + penambah;
penambah = deret [i-1]
end;

‘cetak deret

for i = 1 to suku do
write(deret[i])
end.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: