Arsip: [MASTER DELPHI HELP ANE]bil Fibbonaci
more 14 years ago
andrypein
gan,,
ane ada tugas nih dari kampus tentang buat bil fibonaci,,
ane udah buat pascalnya,,
scriptnya kaya gini:
program bil_deret; uses wincrt; var a,b,c,d:integer; bil:array of integer; deret:arrayof integer; f1,f2:integer; begin gotoxy(25,1); writeln('Deret Bilangan Deret'); writeln; write('Masukan Bilangan Pertama : ');readln(a); write('Masukan Bilangan Kedua : ');readln(b); writeln; write('Tentukan banyaknya deret? ');readln(c); deret[1]:=a; deret[2]:=b; f1:=a; f2:=b; d:=3; while (bil[d]<=c) do begin deret[d]:=f1+f2; f1:=deret[d-1]; f2:=deret[d]; d:=d+1; end; d:=1; while (d<=c) do begin write(deret[d],' '); d:=d+1; end; end.alhamdulillah work dan emang yang diminta dosen begitu,,, lantas dosen suruh kami coba di delphinya... ko hasilnya tidak sama yang di pascal??? malah jadi ngaco begitu,, plis bantu ane,,letak kesalahannya ada dimana?? :( [/quote]
more 14 years ago
Tbawor
program Fibonacci;
{$APPTYPE CONSOLE} //---------directive aplikasi console
uses
SysUtils;
//----------------------
var
a,b,c,d:integer;
bil:array of integer;
deret:arrayof integer;
f1,f2:integer;
//----------------------
begin
writeln('Deret Bilangan Deret');
writeln;
write('Masukan Bilangan Pertama : ');readln(a);
write('Masukan Bilangan Kedua : ');readln(b);
writeln;
write('Tentukan banyaknya deret? ');readln(c);
deret[1]:=a;
deret[2]:=b;
f1:=a;
f2:=b;
d:=3;
//----------------------
while (bil[d]<=c) do begin
deret[d]:=f1+f2;
f1:=deret[d-1];
f2:=deret[d];
d:=d+1;
end;
//----------------------
d:=1;
while (d<=c) do begin
write(deret[d],' ');
d:=d+1;
end;
readln;
end.
more ...
- Pages:
- 1
reply |
Report Obsolete
Last Articles
Last Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 4 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 4 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 5 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 12 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 12 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 12 years ago
Random Topic
- Tanya tentang enkripsi (baru belajar neh)
by goosemunk in Tutorial & Community Project more 18 years ago - S1 or kerja???
by n3o_cybertech in Hal umum tentang Pascal Indonesia more 17 years ago - Kopi Darat v2 (beta version) - rilis 5-juli-2009
by LuriDarmawan in Hal umum tentang Pascal Indonesia more 15 years ago - copy banyak data dari table a ke table b, beda strukture
by fira in MySQL more 15 years ago - Mencari Hex String di File
by fcomputer in Tip n Trik Pemrograman more 15 years ago - Parameter utk report
by l1th1um in Reporting more 17 years ago - nanya tentang program penjualan
by Erlangga in Tip n Trik Pemrograman more 17 years ago - Kebiasaan para programmer
by budicysco in OOT more 17 years ago - Awas Penipuan
by DelphiExpert in OOT more 17 years ago - Client gak bisa connect ke MySQL server II
by rusli_chow in Tip n Trik Pemrograman more 16 years ago