Kamis, 03 November 2011

Program Fibonacci Pascal

program fibonacci;
uses wincrt;
var
  n,i,j:integer;
  deret:array[1..100] of integer;

begin
 clrscr;
 writeln('PROGRAM FIBONACCI');
 write('Masukan jumlah deret :');
 readln(n);
 for i := 1 to n do
 begin
   for j := 1 to n do
   begin
   if i=j then
   begin
    if (i = 1) or (i = 2) then
    begin
      deret[i]:=1;
      write(deret[i]);
     end
    else
    begin
      deret[i]:=deret[i-1]+deret[i-2];
      write(deret[i]);
    end;
   end else
     write('-');
 end;
 writeln;
end;
writeln;
writeln(' -------------------------------');
writeln('|    Nama : YUDHA AGUNG WIRAWAN |');
writeln('|    NIM  : 118110038           |');
writeln('|_______________________________|');
readln;
end.


0 komentar:

Posting Komentar

Related Posts Plugin for WordPress, Blogger...

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | JCPenney Coupons