<codenesia/> || Pascal | Membuat Deret Bilangan Fibonacci
uses wincrt;
var
n,i : integer;
a : array [0..100] of integer;
begin
clrscr;
gotoxy (25,05); write ('____________________________');
gotoxy (25,06); write (' ');
gotoxy (25,07); write (' DERET BILANGAN FIBONACCI ');
gotoxy (25,08); write ('____________________________');
gotoxy (25,12); write ('Masukkan angka pembatas : '); readln (n);
gotoxy (25,15);
for i := 0 to n-1 do
begin
if (i=0) or (i=1) then
begin
a [i] := 1;
write (a [i],' ');
end
else
begin
a [i] := a [i-1] + a [i-2];
write (a [i],' ');
end;
end;
readkey;
end.
var
n,i : integer;
a : array [0..100] of integer;
begin
clrscr;
gotoxy (25,05); write ('____________________________');
gotoxy (25,06); write (' ');
gotoxy (25,07); write (' DERET BILANGAN FIBONACCI ');
gotoxy (25,08); write ('____________________________');
gotoxy (25,12); write ('Masukkan angka pembatas : '); readln (n);
gotoxy (25,15);
for i := 0 to n-1 do
begin
if (i=0) or (i=1) then
begin
a [i] := 1;
write (a [i],' ');
end
else
begin
a [i] := a [i-1] + a [i-2];
write (a [i],' ');
end;
end;
readkey;
end.
Screnshoot
Download File : Membuat Deret Bilangan Fibonacci
Password : codenesia
Jika ada pertanyaan mengenai "Menentukan Hari Berdasarkan Input Tanggal" silahkan tinggalkan komentar !
0 komentar:
Posting Komentar