Program n1; const n = 15; var a:array[1..n] of integer; i,j,buf:integer; begin randomize; writeln('исходный массив:'); for i:=1 to n do begin a[i]:=random(31); write(a[i],' '); end; for i:=1 to n-1 do for j:=i+1 to n do if a[i]>a[j] then begin buf:=a[i]; a[i]:=a[j]; a[j]:=buf; end; writeln; writeln('массив по возрастанию:'); for i:=1 to n do write(a[i],' '); end.
const n = 15;
var a:array[1..n] of integer;
i,j,buf:integer;
begin
randomize;
writeln('исходный массив:');
for i:=1 to n do
begin
a[i]:=random(31);
write(a[i],' ');
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then begin
buf:=a[i];
a[i]:=a[j];
a[j]:=buf;
end;
writeln;
writeln('массив по возрастанию:');
for i:=1 to n do write(a[i],' ');
end.