uses crt;
var
bil,bil2,baris,i : integer;
kombinasi : longint;
function fak (x: integer) : longint;
var
hasil : longint;
i : integer;
begin
hasil := 1;
for i := 1 to x do
hasil := hasil * i;
fak := hasil;
end;
begin
clrscr;
write ('Masukkan banyak baris :');
readln (baris);
for bil := 0 to baris-1 do
begin
for i := 1 to baris-bil do
begin
write (' ');
end;
for bil2 := 0 to bil do
begin
kombinasi := fak(bil)div(fak(bil-bil2)*fak(bil2));
write (kombinasi :4);
end;
writeln;
end;
readkey;
end.
Outputnya kaya begini nih..
No comments:
Post a Comment