Wednesday, November 4, 2009

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.

3 comments:

  1. salam sahabat
    ehm..good posting make me know more...thnxs n good luck ya...

    ReplyDelete