program Count2;
var
m: array [1..3, 1..3] of integer;
i, j, count: integer;
begin
for i := 1 to 3 do
for j := 1 to 3 do
m[i][j] := random(10);
write(m[i][j], ' ');
end;
writeln();
count := 0;
if m[i][j] = 2 then
count += 1;
writeln('ответ: ', count);
end.
Объяснение:
program Count2;
var
m: array [1..3, 1..3] of integer;
i, j, count: integer;
begin
for i := 1 to 3 do
begin
for j := 1 to 3 do
begin
m[i][j] := random(10);
write(m[i][j], ' ');
end;
writeln();
end;
count := 0;
for i := 1 to 3 do
for j := 1 to 3 do
if m[i][j] = 2 then
count += 1;
writeln('ответ: ', count);
end.
Объяснение: