uses crt;
var i,j,n : integer;
A:array[0..20,0..21] of integer;
label ulang;
begin
ulang:
clrscr;
write('masukkan berapa banyak tingkat segitiga = '); readln(n);
if (n > 100) then goto ulang;
A[0,1]:=1;
writeln;
writeln(1);
for i:=1 to n do begin
for j:=1 to i+1 do begin
A[i,j]:=A[i-1,j]+A[i-1,j-1];
write(A[i,j],' ');
end;
writeln;
end;
readln;
end.
Tampilan Output :
0 komentar:
Posting Komentar