Pages

Blogroll

Program Deret Fibonacci pada Pascal

Kamis, 19 Maret 2015

uses crt;
var
a,i: longint;

function fibonacci(n:integer):integer;
begin
if(n=1) then
fibonacci:=1
else
if (n=2) then
fibonacci:=1
else
fibonacci:= fibonacci(n-1)+fibonacci(n-2);
end;
begin
clrscr;
writeln('=======================');
writeln('|    DERET FIBONACCI  |');
writeln('=======================');
writeln('|  input value :      |');
writeln('=======================');
gotoxy(17,4);readln(a);
writeln;
for i := 1 to a do
write(fibonacci(i),'  ');
readln;
end.



Inilah Output Program Deret Fibonacci:




Tidak ada komentar:

Posting Komentar

 

Most Reading

Sidebar One