program SEGITIGA_PASCAL_REKURSI;
uses crt;
var c,i,j,n,batas:integer;
procedure segitigapascal;
var num:array[1..100] of longint;
begin
if c < 1 then
begin
num[1]:=1;
writeln(1);
for i:=1 to n do
begin
batas:=(i+1) div 2;
if not odd(i)then
num[batas+1]:=num[batas]*2;
for j:=batas downto 2 do
num[j]:=num[j]+num[j-1];
for j:=1 to batas do
write(num[j],' ');
if not odd(i)then write (num[batas+1],' ');
for j:=batas downto 1 do
write(num[j],' ');
writeln;
end;
c := c+1;
segitigapascal;
end;
end;
begin
clrscr;
writeln('SEGITIGA PASCAL');
writeln('===============');
writeln;
write(' Inputkan panjang n segitiga pascal :'); readln(n);
segitigapascal;
readln;
end.
Tidak ada komentar:
Posting Komentar