Total Tayangan blog saya(fahru)

Selasa, 22 Mei 2012

Program Fibonaci pada Turbo Pascal 7 For Windows


program fibonaci;
uses wincrt;
procedure FIBO(key : string; k : integer);
var
x,y,z,i,n:longint;
baris : word;


begin
x:=1;
y:=1;
writeln(' *', key, '*');
for baris:=1 to k do
begin
writeln;
end;
write(' Masukkan banyaknya bilangan fibonacci = ');readln(n);
write(x, ' ');
write(y, ' ');
for i:=1 to n-2 do
begin
z:=x+y;
x:=y;
y:=z;
write(z, ' ');
end;
end;
begin
FIBO('Simple Fibonacci', 2);
end.

Tidak ada komentar: