//Pascal ABC.NET v3.1 сборка 1172
Const
n=4;
m=4;
Var
ar:array[1..n,1..m] of integer;
i,j:integer;
begin
randomize;
writeln('First matrix:');
for i:=1 to n do
begin
for j:=1 to m do
begin
ar[i,j]:=random(100);
write(ar[i,j]:4);
if ar[i,j] mod 3=2 then inc(ar[i,j]);
end;
writeln;
end;
writeln('Final matrix:');
for i:=1 to n do
begin
for j:=1 to m do
write(ar[i,j]:4);
writeln;
end;
end.
Пример вывода:
First matrix:
20 80 1 69
25 77 97 3
32 56 97 23
99 81 12 82
Final matrix:
21 81 1 69
25 78 97 3
33 57 97 24
99 81 12 82