const n=5;
type mas=array[1..n,1..n] of integer;
procedure Vvod(var v:mas);
var i,j:integer;
begin
for j:=1 to n do
for i:=1 to n do
v[i,j]:=random(100)-50;
end;
procedure Vyvod(var v:mas);
var i,j:integer;
begin
for j:=1 to n do begin
for i:=1 to n do begin
write(v[i,j]:4);
end;
writeln;
end;
writeln;
writeln;
end;
procedure Smena(var v:mas);
var i,j,buf:integer;
begin
for i:=1 to n do begin
buf:=v[i,i];
v[i,i]:=v[i,n+1-i];
v[i,n+1-i]:=buf;
end;
for j:=1 to n do begin
for i:=1 to n do begin
write(v[i,j]:4);
end;
writeln;
end;
end;
var a,b:mas;
begin
Vvod(a);
Vyvod(a);
Smena(a);
end.
type mas=array[1..n,1..n] of integer;
procedure Vvod(var v:mas);
var i,j:integer;
begin
for j:=1 to n do
for i:=1 to n do
v[i,j]:=random(100)-50;
end;
procedure Vyvod(var v:mas);
var i,j:integer;
begin
for j:=1 to n do begin
for i:=1 to n do begin
write(v[i,j]:4);
end;
writeln;
end;
writeln;
writeln;
end;
procedure Smena(var v:mas);
var i,j,buf:integer;
begin
for i:=1 to n do begin
buf:=v[i,i];
v[i,i]:=v[i,n+1-i];
v[i,n+1-i]:=buf;
end;
for j:=1 to n do begin
for i:=1 to n do begin
write(v[i,j]:4);
end;
writeln;
end;
end;
var a,b:mas;
begin
Vvod(a);
Vyvod(a);
Smena(a);
end.