program mas_sort_ub_i_max;
const
n=15;
var
a:array[1..n] of integer;
i,t,j:integer;
begin
writeln('Массив исходный 》');
for i:=1 to n do
a[i]:=random(41)-20;
write(a[i]:3,' ');
end;
writeln;
for i:=1 to n-1 do
for j:=i+1 to n do
if (a[i])>(a[j]) then
t:=a[i];
a[i]:=a[j];
a[j]:=t;
writeln('Массив отсортированный 》');
write(a[i]:3,' ')
end.
===== PascalABC.NET =====
var a := ArrRandom(15, -99, 99);
a.Println;
a.Sort;
a.Print
program mas_sort_ub_i_max;
const
n=15;
var
a:array[1..n] of integer;
i,t,j:integer;
begin
writeln('Массив исходный 》');
for i:=1 to n do
begin
a[i]:=random(41)-20;
write(a[i]:3,' ');
end;
writeln;
for i:=1 to n-1 do
for j:=i+1 to n do
if (a[i])>(a[j]) then
begin
t:=a[i];
a[i]:=a[j];
a[j]:=t;
end;
writeln('Массив отсортированный 》');
for i:=1 to n do
write(a[i]:3,' ')
end.
===== PascalABC.NET =====
begin
var a := ArrRandom(15, -99, 99);
a.Println;
a.Sort;
a.Print
end.