program exs; var a : array [1..1000] of integer; n, i : integer;
procedure qsort(l, r: integer); var i, j, key, buf : integer; begin i := l; j:= r; key:=a[(l+r) div 2]; repeat while a[i] < key do inc(i); while a[j] > key do dec(j); if i<=j then begin buf:=a[i]; a[i]:=a[j]; a[j]:=buf; inc(i); dec(j); end; until (i>j); if (l < j) then qsort(l, j); if (i < r) then qsort(i, r); end;
begin readln(n); for i:= 1 to n do begin read(a[i]); end; qsort(1, n); for i:=1 to n do begin write(a[i], ' '); end; end.
1)
Var
a:array[1..10] of integer;
i:integer;
begin
for i:=1 to 10 do
read(a[i]);
randomize;
for i:=1 to 10 do
a[i]:=random(136)+22;
for i:=1 to 10 do
if a[i]>100 then writeln(a[i]);
end.
2.
var
a,n:integer;
begin
readln(a,n);
a:=a^n;
writeln(a);
end;
6.
var
x:array[1..5] of real;
i:integer;
begin
for i:=1 to 5 do
begin
read(x[i]);
if x[i]=9 then x[i]:=x[i]*3;
if x[i]>9 then x[i]:=x[i]/10;
writeln(x[i]);
end;
end.
program exs;
var a : array [1..1000] of integer;
n, i : integer;
procedure qsort(l, r: integer);
var i, j, key, buf : integer;
begin
i := l;
j:= r;
key:=a[(l+r) div 2];
repeat
while a[i] < key do inc(i);
while a[j] > key do dec(j);
if i<=j then begin
buf:=a[i];
a[i]:=a[j];
a[j]:=buf;
inc(i);
dec(j);
end;
until (i>j);
if (l < j) then qsort(l, j);
if (i < r) then qsort(i, r);
end;
begin
readln(n);
for i:= 1 to n do begin
read(a[i]);
end;
qsort(1, n);
for i:=1 to n do begin
write(a[i], ' ');
end;
end.