Второе задание. Тоже обе программы объединены:
Код:
Const
M=10;
N=12;
Var
A:Array[1..M] of Byte;
B:Array[1..M,1..N] of Byte;
i,j,Num:Byte;
Begin
Randomize;
for i:=1 to M do
begin
A[i]:=Random(256);
write(A[i]:4);
end;
Writeln;
Writeln;
Writeln(' i A[i]');
Num:=0;
for i:=2 to M-1 do
if A[i]<(A[i-1]+A[i+1])/2 then
begin
Inc(Num);
Writeln(i:2,A[i]:8);
end;
Writeln;
Writeln(Num, ' elements');
Writeln('Press "Enter" to continue');
Readln;
for i:=1 to M do
begin
for j:=1 to N do
begin
B[i,j]:=Random(256);
Write(B[i,j]:4);
end;
Writeln;
end;
Writeln;
Writeln;
Writeln('Minimal elements:');
Writeln(' i El');
for i:=1 to M do
begin
A[i]:=B[i,1];
for j:=2 to N do
if B[i,j]<A[i] then A[i]:=B[i,j];
Writeln(i:2,A[i]:8);
end;
Readln
End.