const
nmax=100;
type
mas=array[1..nmax] of integer;
var
n,i,j,buf:integer;
a:mas;
begin
repeat
write('Vvedite n->');
readln(n);
until n>0;
for i:=1 to n do
begin
a[i]:=random(2);
write(a[i]:4);
end;
writeln;
for i:=n-1 downto 1 do
for j:=1 to i do
if a[j]>a[j+1] then
begin
buf:=a[j];
a[j]:=a[j+1];
a[j+1]:=buf;
end;
writeln('Uporyadochenniy massiv:');
for i:=1 to n do
write(a[i]:4);
readln;
end.
nmax=100;
type
mas=array[1..nmax] of integer;
var
n,i,j,buf:integer;
a:mas;
begin
repeat
write('Vvedite n->');
readln(n);
until n>0;
for i:=1 to n do
begin
a[i]:=random(2);
write(a[i]:4);
end;
writeln;
for i:=n-1 downto 1 do
for j:=1 to i do
if a[j]>a[j+1] then
begin
buf:=a[j];
a[j]:=a[j+1];
a[j+1]:=buf;
end;
writeln('Uporyadochenniy massiv:');
for i:=1 to n do
write(a[i]:4);
readln;
end.