Rabu, 29 Oktober 2014

contoh program 14

uses crt;
var
       bat, x, y: integer;
begin
clrscr;
       write('Masukkan Batas deret   : '); readln(bat);
       
       x:= 1;
       y:= 1;
                   
       write(x, ' ');
                   
       while (x <= bat) or (y <= bat) do
       begin
                   x:= x + y;
                   y:= y + x;
                   
                   if (x <= bat) then
                   write(x, ' ');
                   if (y <= bat) then
                   write(y, ' ');
       end;
       readln;
end.

Tidak ada komentar:

Posting Komentar