var matrix: array[1..5, 1..5] of integer; count, i, j: integer;
begin count := 0;
// заполнение матрицы случайными числами от -9 до 9 randomize; for i := 1 to 5 do begin for j := 1 to 5 do begin matrix[i, j] := random(19) - 9; write(matrix[i, j]:4); if (matrix[i, j] > -10) and (matrix[i, j] < 10) then begin count := count + 1; writeln(' (' + i.toString + ', ' + j.toString + ')'); end; end; writeln; end;
writeln('Number of single digit elements: ', count); end.
program singleDigitElements;
var
matrix: array[1..5, 1..5] of integer;
count, i, j: integer;
begin
count := 0;
// заполнение матрицы случайными числами от -9 до 9
randomize;
for i := 1 to 5 do
begin
for j := 1 to 5 do
begin
matrix[i, j] := random(19) - 9;
write(matrix[i, j]:4);
if (matrix[i, j] > -10) and (matrix[i, j] < 10) then
begin
count := count + 1;
writeln(' (' + i.toString + ', ' + j.toString + ')');
end;
end;
writeln;
end;
writeln('Number of single digit elements: ', count);
end.