1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
program sort;
type a=array[1..1000]of integer;
var
m:a;
i,n:integer;
procedure sortm(var m:a;n:integer);//сортировка массива
var
i,j,buf:integer;
begin
for i:=1 to n
do
for j:=i+1 to n do
if(m[i]>m[j])
then
begin
buf:=m[j];
m[j]:=m[i];
m[i]:=buf;
end;
end;
begin
randomize;
read(n);
for i:=1 to n do
m[i]:=random(999);
sortm(m,n);
for i:=1 to n
do
write(' ',m[i]);
end.