Const n=4; var y : array[1..n,1..n] of integer; t : array[1..n] of integer; i,j : integer; begin Randomize; for i:=1 to n do begin for j:=1 to n do begin y[i,j]:=random(20)-10; write(y[i,j]:4); end; writeln; end; for i:=1 to n do t[i]:=y[i,i]; writeln('Полученный массив:'); for i:=1 to n do write(t[i]:5); writeln; end.
Answers & Comments
Verified answer
Const n=4;var y : array[1..n,1..n] of integer;
t : array[1..n] of integer;
i,j : integer;
begin
Randomize;
for i:=1 to n do
begin
for j:=1 to n do
begin
y[i,j]:=random(20)-10;
write(y[i,j]:4);
end;
writeln;
end;
for i:=1 to n do t[i]:=y[i,i];
writeln('Полученный массив:');
for i:=1 to n do write(t[i]:5);
writeln;
end.