Const n=4; m=5; var a:array [1..n,1..m] of integer; i,j,min,imin,jmin:integer; begin Randomize; Writeln('Исходный массив:'); for i:=1 to n do begin for j:=1 to m do begin a[i,j]:=random(21)-10; write(a[i,j]:6); end; writeln; end; min:=a[1,1]; imin:=1;jmin:=1; for i:=1 to n do for j:=1 to m do if a[i,j]<min then begin min:=a[i,j]; imin:=i; jmin:=j; end; writeln('min=a[',imin,',',jmin,']=',min); end.
var a:array [1..n,1..m] of integer;
i,j,min,imin,jmin:integer;
begin
Randomize;
Writeln('Исходный массив:');
for i:=1 to n do
begin
for j:=1 to m do begin
a[i,j]:=random(21)-10;
write(a[i,j]:6);
end;
writeln;
end;
min:=a[1,1]; imin:=1;jmin:=1;
for i:=1 to n do
for j:=1 to m do
if a[i,j]<min then
begin min:=a[i,j]; imin:=i; jmin:=j; end;
writeln('min=a[',imin,',',jmin,']=',min);
end.
Пример:
Исходный массив:
5 8 2 -5 -4
1 -10 9 1 -4
8 2 -6 -4 -4
8 7 3 2 2
min=a[2,2]=-10