Var a:array [1..10] of Integer; i,temp:Integer; f:Boolean; begin Randomize; for i:=1 to 10 do a[i]:=Random(100); for i:=1 to 10 do write(a[i]:3); Writeln; repeat f:=False; for i:=1 to 9 do begin if a[i]>a[i+1] then begin f:=True; temp:=a[i]; a[i]:=a[i+1]; a[i+1]:=temp; end; end; until not f; for i:=1 to 10 do write(a[i]:3); temp:=0; for i:=1 to 3 do temp:=temp+a[i]; Writeln; Writeln(temp); Readln; end.
begin
Randomize;
for i:=1 to 10 do
a[i]:=Random(100);
for i:=1 to 10 do
write(a[i]:3);
Writeln;
repeat
f:=False;
for i:=1 to 9 do
begin
if a[i]>a[i+1] then
begin
f:=True;
temp:=a[i];
a[i]:=a[i+1];
a[i+1]:=temp;
end;
end;
until not f;
for i:=1 to 10 do
write(a[i]:3);
temp:=0;
for i:=1 to 3 do
temp:=temp+a[i];
Writeln;
Writeln(temp);
Readln;
end.