Kamis, 05 Januari 2012

Deret


1)     Deret Angka

program deret;
uses wincrt;
var
i, a : integer;
begin
a:= 1;
for i:= 1 to 6 do
write (a,' ');
a:= a+3;
end;
end.
2)     Deret Fibonacci

program fibonacci;

uses wincrt;

var

b,a,c,i,n : integer;

begin

      readln (n);

                  a:= 0;

                  b:= 1;

                  for i := 1 to n do

      begin

                  c:= b;

                  b:= a;

                  a:= a + c;

      write (a,' ');

      end;

end.


Tidak ada komentar: