var a: array[1..4,1..5] of integer;
i,j,s:integer;
begin
randomize;
for i:=1 to 4 do
for j:=1 to 5 do
a[i,j]:=random(21)-10;
write(a[i,j],' ');
end;
writeln;
if (i+j) mod 2=1 then
s:=s+a[i,j];
writeln(s)
end.
Объяснение:
var a: array[1..4,1..5] of integer;
i,j,s:integer;
begin
randomize;
for i:=1 to 4 do
begin
for j:=1 to 5 do
begin
a[i,j]:=random(21)-10;
write(a[i,j],' ');
end;
writeln;
end;
for i:=1 to 4 do
for j:=1 to 5 do
if (i+j) mod 2=1 then
s:=s+a[i,j];
writeln(s)
end.
Объяснение: