Const K = 3; N = 4; Var A:array[1..K,1..N] of integer; Max,Min,i,j:integer; Begin For i:= 1 to K do Begin For j:= 1 to N do Begin A[i,j]:=random(21)-10; Write(A[i,j]:3,' ') End; WriteLn End; Max:=A[K,N]; Min:=A[K,N]; For i:= 1 to K do For j:= 1 to N do Begin if Max<A[i,j] then Max:=A[i,j]; if Min>A[i,j] then Min:=A[i,j] End; WriteLn('Min = ',Min); WriteLn('Max = ',Max); End.
K = 3;
N = 4;
Var
A:array[1..K,1..N] of integer;
Max,Min,i,j:integer;
Begin
For i:= 1 to K do
Begin
For j:= 1 to N do
Begin
A[i,j]:=random(21)-10;
Write(A[i,j]:3,' ')
End;
WriteLn
End;
Max:=A[K,N];
Min:=A[K,N];
For i:= 1 to K do
For j:= 1 to N do
Begin
if Max<A[i,j] then Max:=A[i,j];
if Min>A[i,j] then Min:=A[i,j]
End;
WriteLn('Min = ',Min);
WriteLn('Max = ',Max);
End.
Пример:
-3 -2 5 -8
2 -3 7 5
-10 -2 7 4
Min = -10
Max = 7