вот не забудь нажать Объяснение:
var
arr : Array[1..100] Of ShortInt;
temp : ShortInt;
i, j, n : Byte;
begin
Write('n='); ReadLn(n);
Randomize;
for i := 1 to n do
arr[i] := Random(11) - 5;
Write(arr[i], ' ');
end;
WriteLn; WriteLn;
for i := 2 to n do
for j := n downto i do
if (((arr[j - 1] <= 0) And (arr[j] > 0)) Or ((arr[j - 1] < 0) And (arr[j] = 0)))
then
temp := arr[j - 1];
arr[j - 1] := arr[j];
arr[j] := temp;
end.
вот не забудь нажать Объяснение:
var
arr : Array[1..100] Of ShortInt;
temp : ShortInt;
i, j, n : Byte;
begin
Write('n='); ReadLn(n);
Randomize;
for i := 1 to n do
begin
arr[i] := Random(11) - 5;
Write(arr[i], ' ');
end;
WriteLn; WriteLn;
for i := 2 to n do
for j := n downto i do
if (((arr[j - 1] <= 0) And (arr[j] > 0)) Or ((arr[j - 1] < 0) And (arr[j] = 0)))
then
begin
temp := arr[j - 1];
arr[j - 1] := arr[j];
arr[j] := temp;
end;
for i := 1 to n do
Write(arr[i], ' ');
end.