Program Djonny1981;
uses crt;
const
m=5;
var
a: array[1..m,1..m] of integer;
i, j: integer;
sum: integer;
begin
randomize;
sum:=0;
for i:=1 to m do
begin
for j:=1 to m do
begin
a[i,j]:=random(101)-50;
write(a[i,j]:5);
end;
writeln();
end;
for i:=1 to m do
for j:=1 to m do
if j mod 2 = 0 then {вот здесь проверка, чётный ли столбец}
sum := sum + a[i,j];
writeln('Сумма элементов чётных столбцов равна ',sum);
if sum>0 then
for i:=1 to m do
for j:=1 to m do
if i mod 2 = 1 then
a[i,j]:=a[i,j]*a[i,j]
else
for i:=1 to m do
a[m-i+1,i]:=a[m-i+1,i]+2;
for i:=1 to m do
begin
for j:=1 to m do
write(a[i,j]:5);
writeln();
end;
end.