Answer the question
In order to leave comments, you need to log in
What does the line min := i mean?
program choiсesort;
var mas: array[1..5] of integer; j, i, min, obmen, gen: integer;
begin
randomize;
for gen:=1 to 5 do mas[gen]:=random(1, 10);
writeln(mas);
for i:=1 to 4 do begin
min := i; {<----- почему мы присваиваем минимуму значение i ?}
for j:=i to 5 do if mas[j] < mas[min] then min:=j;
if min <> i then begin
obmen := mas[i];
mas[i]:=mas[min];
mas[min]:=obmen;
writeln(mas);
end;
end;
end.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question