Program Program1;
var i, j, n: integer;
Arr: array [1..255] of integer;
FileArr: text;
procedure swap(var x, y: integer);
var t: integer;
begin
t := x; x := y; y := t
end;
begin
assign(FileArr, 'Array.txt');
rewrite(FileArr);
randomize;
write('Введите значение N: ');
readln(n);
for i := 1 to n do
begin
Arr[i] := random(100);
end;
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]);
for i := 1 to n do
begin
writeln(Arr[i]);
end;
for i := 1 to n do
begin
writeln(FileArr, Arr[i]);
end;
close(FileArr);
end.