Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var i,n,c,j, m:integer;
- a:array[1..10000] of integer;
- begin
- readln(n);
- for i:=1 to n do begin
- read (a[i]);
- end;
- m:=n div 2;
- for j:=1 to m-1 do begin
- for i:=1 to m-j do begin
- if a[i]>a[i+1]
- then swap(a[i],a[i+1]);
- end;
- end;
- for j:=1 to m do begin
- for i:=m+1 to n-j do begin
- if a[i]<a[i+1]
- then swap(a[i],a[i+1]);
- end;
- end;
- for i:=1 to n do begin
- write(a[i], ' ');
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement