Const
N = 50;
Var
A:array[1..N] of byte;
i,j,B:byte;
Begin
Randomize;
Write('Исходный массив:');
For i:= 1 to N do
Begin
A[i]:=random(101);
Write(' ',A[i])
End;
For i:= 1 to N do
For j:= 1 to N-1 do
if A[j]>A[j+1] then
Begin
B:=A[j];
A[j]:=A[j+1];
A[j+1]:=B;
End;
WriteLn;
WriteLn;
Write('Отсортированный массив:');
For i:= 1 to N do
Write(' ',A[i]);
WriteLn;
WriteLn;
WriteLn('Min + Max = ',A[1]+A[N]);
End.