Tuesday, June 12, 2012

Pascal Program Bilangan Fibonacci

,
 uses crt;
 var
 i,j,a:integer;
 simpan : array[0..100] of integer;
 begin
      clrscr;
       Writeln('         Program Bilangan Fibonacci ');
       writeln('        -------RIZKA FAJRIAH-------');writeln;
      write('Masukkan jumlah looping : ');readln(a);
      for i:= 0 to a do
      begin
       if (i=0) or (i=1) then
       begin
       simpan[i]:=1;
       write(simpan[i],' ');
       end
       else
       begin
       simpan[i] := simpan[i-1]+simpan[i-2];
       write(simpan[i],' ');
       end;
      end;
      readln;
 end.

Output :

0 comments to “ Pascal Program Bilangan Fibonacci ”

Post a Comment