Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program V9;
- uses
- SysUtils;
- const n=10;
- var m:array [1..N] of shortint;
- i,j,k,L:integer; b,mi,mi1:shortint;
- begin
- randomize;
- L:=N;
- for i:=1 to L do begin
- m[i]:=random(11)-20;
- write(m[i],' ')
- end;
- writeln;
- //тут
- k:=1;
- repeat
- i:=1;
- repeat
- mi:=m[i];
- mi1:=m[i+1];
- if mi = mi1 then begin
- for j:=i+1 to L-1 do m[j]:=m[j+1];
- dec(L);
- dec(i);
- end
- else if mi < mi1 then begin
- b:=mi;
- mi:=mi1;
- mi1:=b;
- m[i]:=mi;
- m[i+1]:=mi1;
- end;
- inc(i);
- until i>L-1;
- inc(k);
- until K>L-1;
- // тут
- for i:=1 to L do write(m[i],' ');
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement