Program Matr22;
Uses Crt;
type matrix=array[1..5,1..5] of integer;
var m:matrix;
n:byte;
procedure Auto;var i,j:integer;begin
n:=0; randomize; for i:=1 to 5 do begin for j:=1 to 5 do begin m[i,j]:=random(50)+5;
if (m[i,j]=22) then n:=n+1; end; end;end;
procedure PrintMatrix(mas:matrix;);var j,k:integer;begin for k:=1 to 5 do begin for j:=1 to 5 do begin write(mas[k,j]:3); end; writeln; end;end;
begin
clrscr;
Auto;
PrintMatrix(m);
writeln;
writeln('Количество элементов равных 22:',n);
readkey;
end.
Program Matr22;
Uses Crt;
type matrix=array[1..5,1..5] of integer;
var m:matrix;
n:byte;
procedure Auto;
var i,j:integer;
begin
n:=0;
randomize;
for i:=1 to 5 do
begin
for j:=1 to 5 do
begin
m[i,j]:=random(50)+5;
if (m[i,j]=22) then n:=n+1;
end;
end;
end;
procedure PrintMatrix(mas:matrix;);
var j,k:integer;
begin
for k:=1 to 5 do
begin
for j:=1 to 5 do
begin
write(mas[k,j]:3);
end;
writeln;
end;
end;
begin
clrscr;
Auto;
PrintMatrix(m);
writeln;
writeln('Количество элементов равных 22:',n);
readkey;
end.