Program Selection;
Var Mas: array[1..20] of integer;
i,n,j, Min, N_Min: integer;
Begin
Writeln('n='); read(n);
Randomize;
For i:=1 to n do Mas[i]:=random (10)+15;
For i:=1 to N do writeln('Mas[',i,']=',MAS[i]);
writeln;
For i:=1 to N-1 do
Begin
Min:=Mas[i];
N_Min:=i;
for j:=i+1 to N do
if Mas[j]<Min then
Begin
Min:=Mas[j];
N_Min:=j;
End;
Mas[N_Min]:=Mas[i];
Mas[i]:=Min;
End;
For i:=1 to N do writeln('Mas[',i,']=',MAS[i]);
End.
Var Mas: array[1..20] of integer;
i,n,j, Min, N_Min: integer;
Begin
Writeln('n='); read(n);
Randomize;
For i:=1 to n do Mas[i]:=random (10)+15;
For i:=1 to N do writeln('Mas[',i,']=',MAS[i]);
writeln;
For i:=1 to N-1 do
Begin
Min:=Mas[i];
N_Min:=i;
for j:=i+1 to N do
if Mas[j]<Min then
Begin
Min:=Mas[j];
N_Min:=j;
End;
Mas[N_Min]:=Mas[i];
Mas[i]:=Min;
End;
For i:=1 to N do writeln('Mas[',i,']=',MAS[i]);
End.
Комментариев нет:
Отправить комментарий