Const N = 10; Var A:array[1..N,1..N] of integer; i,j,iMin,jMin:integer; Begin Randomize; iMin:=1; jMin:=1; WriteLn('Исходный массив:'); For i:= 1 to N do Begin For j:= 1 to N do Begin A[i,j]:=random(21)-10; Write(A[i,j]:3,' '); if A[i,j]<A[iMin,jMin] then Begin iMin:=i; jMin:=j; End End; WriteLn End; WriteLn; WriteLn('Min(A) = A[',iMin,',',jMin,'] = ',A[iMin,jMin]) End.
N = 10;
Var
A:array[1..N,1..N] of integer;
i,j,iMin,jMin:integer;
Begin
Randomize;
iMin:=1;
jMin:=1;
WriteLn('Исходный массив:');
For i:= 1 to N do
Begin
For j:= 1 to N do
Begin
A[i,j]:=random(21)-10;
Write(A[i,j]:3,' ');
if A[i,j]<A[iMin,jMin] then
Begin
iMin:=i;
jMin:=j;
End
End;
WriteLn
End;
WriteLn;
WriteLn('Min(A) = A[',iMin,',',jMin,'] = ',A[iMin,jMin])
End.
Пример:
Исходный массив:
4 -8 -4 10 8 10 -1 -7 -5 -1
-3 -8 0 4 7 -1 2 1 3 9
8 -3 8 7 -5 6 -10 -5 6 6
7 -8 4 4 -6 0 6 -6 -7 -8
-5 -7 0 -8 -4 4 -7 0 1 -3
-3 -1 9 9 -4 -4 -5 0 4 -9
9 -7 -3 0 3 -5 -1 6 -1 -3
4 -3 -2 1 4 5 8 6 1 2
3 0 5 -1 -2 -3 -7 5 -3 8
-6 -4 0 -9 -7 -9 6 10 -1 -10
Min(A) = A[3,7] = -10