Программа:
Pascal:
const N = 7;
var
arr: array[1..N] of integer;
i, j: integer;
begin
for i := 1 to 7 do arr[i] := random(0, 100);
writeln(arr);
for j:=1 to N - 1 do
for i:=1 to N - j do
if arr[i] > arr[i+1] then
swap(arr[i], arr[i + 1]);
end.
Программа:
Pascal:
const N = 7;
var
arr: array[1..N] of integer;
i, j: integer;
begin
for i := 1 to 7 do arr[i] := random(0, 100);
writeln(arr);
for j:=1 to N - 1 do
for i:=1 to N - j do
if arr[i] > arr[i+1] then
swap(arr[i], arr[i + 1]);
writeln(arr);
end.