Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
Quy hoạch động nha bạn
program tamgiacpascal;
uses crt;
var A:array[0..100,0..100] of longint;
n,i,j:integer;
begin
clrscr;
write('Nhap n: '); readln(n);
writeln('Tam giac pascal bac ',n,' la: ');
fillchar(A,sizeof(A),0);
A[1,1]:=1;
for i:=2 to n+1 do
for j:=1 to i do
A[i,j]:=A[i-1,j]+A[i-1,j-1];
for i:=1 to n+1 do
begin
for j:=1 to i do
write(A[i,j]:4);
writeln;
end;
readln
end.
Hãy giúp mọi người biết câu trả lời này thế nào?
uses crt;
var i,n,j:byte;
a:array[-2..52,-2..52] of integer;
BEGIN
clrscr;
write('Nhap n:'); readln(n);
for i:=0 to n do
for j:=0 to n do
a[i,j]:=0;
a[1,1]:=1;
for i:=2 to n do
for j:=1 to i do
a[i,j]:=a[i-1,j-1]+a[i-1,j];
for i:=1 to n do
begin
for j:=1 to i do write(a[i,j]:6);
writeln
end;
readln
END.
Chúc bạn học tốt.
Cho mình xin câu trả lời hay nhất.
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin
3152
9745
2319
chạy thử ch
2863
41637
21146
rồi