Program n1; const n = 11; var a: array[1..n] of integer; mins: array[1..3] of integer; i, j, idx, S: integer; first: boolean; begin randomize; S:=1; for i:=1 to n do a[i]:=random(71)-31; for j:=1 to 3 do begin first:=true; for i:=1 to n do if first or (a[i]<mins[j]) then begin mins[j]:=a[i]; idx:=i; first:=false; end; a[idx]:=maxint; end; for i:=1 to 3 do S:=S*mins[i]; writeln(S); end.
Answers & Comments
Verified answer
Program n1;const
n = 11;
var
a: array[1..n] of integer;
mins: array[1..3] of integer;
i, j, idx, S: integer;
first: boolean;
begin
randomize;
S:=1;
for i:=1 to n do a[i]:=random(71)-31;
for j:=1 to 3 do begin
first:=true;
for i:=1 to n do
if first or (a[i]<mins[j]) then begin
mins[j]:=a[i];
idx:=i;
first:=false;
end;
a[idx]:=maxint;
end;
for i:=1 to 3 do S:=S*mins[i];
writeln(S);
end.