Код
const n=5;
var a: array[1..n,1..n] of integer;
i,j:integer;
begin
writeln('vvedite massiv');
randomize;
for i:=1 to n do
for j:=1 to n do
a[i,j]:=random(6);
for i:=1 to n do
for j:=1 to n do
write(a[i,j]:3);
writeln;
for i:=1 to n do
for j:=1 to n do
a[i,n-j+1]:=abs(i-j)+1;
for i:=1 to n do
for j:=1 to n do
Write(a[i,j]:3);
ReadLn
end.
вроде вот так..
если считая по главной диагонали, то
Код
const n=5;
var
a: array[1..n,1..n] of integer;
i,j:integer;
begin
writeln('vvedite massiv');
randomize;
for i:=1 to n do
for j:=1 to n do
a[i,j]:=random(6);
for i:=1 to n do
for j:=1 to n do
write(a[i,j]:3);
writeln;
for i:=1 to n do
for j:=1 to n do
a[i,j]:=abs(i-j)+1;
for i:=1 to n do
for j:=1 to n do
Write(a[i,j]:3);
ReadLn
end.