program fibonaci;
uses wincrt;
uses wincrt;
procedure FIBO(key : string; k : integer);
var
x,y,z,i,n:longint;
baris : word;
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, ' ');
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
z:=x+y;
x:=y;
y:=z;
write(z, ' ');
end;
end;
begin
FIBO('Simple Fibonacci', 2);
end.
FIBO('Simple Fibonacci', 2);
end.
sumber : http://artikelit.com/node/69
Tidak ada komentar:
Posting Komentar