Сделать подпрограмму с ! ! const csize1=7; csize2=6; csize3=5; type tmas1=array[1..csize1,1..csize1] of integer; tmas2=array[1..csize2, 1..csize2] of integer; tmas3=array[1..csize3, 1..csize3] of integer; var a1: tmas1; a2: tmas2; a3: tmas3; i,j,x, y: byte; function zero(i: integer): boolean; begin zero: =false; if i=0 then zero: =true; end; function interval(i: integer): boolean; begin interval: =false; if (i< =12) and (i> =1) then interval: =true; end; begin x: =0; y: =0; randomize; for i: =1 to csize1 do begin for j: =1 to csize1 do begin a1[i, j]: =random(50); write(a1[i, j]: 3); if zero(a1[i, j]) then inc(x); if interval(a1[i,j]) then inc(y); end; writeln; end; writeln('kol-vo 0 =', x); writeln('kol-vo v intervale=', y); writeln; x: =0; y: =0; for i: =1 to csize2 do begin for j: =1 to csize2 do begin a2[i, j]: =random(50); write(a2[i,j]: 3); if zero(a1[i,j]) then inc(x); if interval(a2[i,j]) then inc(y); end; writeln; end; writeln('kol-vo 0 =', x); writeln('kol-vo v intervale=', y); writeln; x: =0; y: =0; for i: =1 to csize3 do begin for j: =1 to csize3 do begin a3[i, j]: =random(50); write(a3[i,j]: 3); if zero(a3[i,j]) then inc(x); if interval(a3[i,j]) then inc(y); end; writeln; end; writeln('kol-vo 0 =', x); writeln('kol-vo v intervale=', y); writeln; x: =0; y: =0; end.
CSize1=7;
CSize2=6;
CSize3=5;
type TMas=array[,] of integer;
var
A1:TMas;
A2:TMas;
A3:TMas;
x, y:byte;
procedure zapoln(var T:TMas;Size:integer);
begin
var i,j:integer;
setlength(T,Size+1,Size+1);
for i:=1 to Size do
begin
for j:=1 to Size do
begin
T[i,j]:=random(50);
write(T[i,j]:3);
end;
writeln;
end;
writeln;
end;
function zero(T:TMas):integer;
var i,j,n:integer;
begin
n:=length(T,0)-1;
for i:=1 to n do
for j:=1 to n do
if T[i,j]=0 then result:=result+1;
end;
function interval(T:TMas):integer;
var i,j,n:integer;
begin
n:=length(T,0)-1;
for i:=1 to n do
for j:=1 to n do
if (1<=T[i,j]) and (T[i,j]<=12) then result:=result+1;
end;
begin
zapoln(A1,CSize1);
zapoln(A2,CSize2);
zapoln(A3,CSize3);
x:=zero(A1)+zero(A2)+zero(A3);
y:=interval(A1)+interval(A2)+interval(A3);
writeln('Kol-vo 0 =', x);
writeln('Kol-vo v intervale=', y);
end.