Const n=20; var min1,min2,i: integer; a: array[1..n] of integer; begin randomize; min1:=MaxInt; min2:=MaxInt; for i:=1 to n do begin a[i]:=random(100); write (a[i]:3); if a[i]<min1 then begin min2:=min1; min1:=a[i]; end else if a[i]<min2 then min2:=a[i]; end; writeln; writeln ('min1 = ',min1); writeln ('min2 = ',min2) end.
var
min1,min2,i: integer;
a: array[1..n] of integer;
begin
randomize;
min1:=MaxInt;
min2:=MaxInt;
for i:=1 to n do begin
a[i]:=random(100);
write (a[i]:3);
if a[i]<min1
then begin min2:=min1; min1:=a[i]; end
else if a[i]<min2
then min2:=a[i];
end;
writeln;
writeln ('min1 = ',min1);
writeln ('min2 = ',min2)
end.
=================================
93 95 16 61 94 54 29 32 30 8 37 53 48 54 60 42 92 71 2 12
min1 = 2
min2 = 8