Program asd; USES crt; Const n=5; var A:array[1..n] of integer; i,j,k:integer; BEGIN for i:=1 to n do begin A[i]:=random(10); Write(A[i]:4); end; for i:=1 to n-1 do begin for j := 1 to n-i do if A[j]>A[j+1] then begin k:=A[j]; A[j]:=A[j+1]; A[j+1]:=k end; end; Writeln; Writeln ('Отсортированный массив по возрастанию: '); for i := 1 to n do Write (A[i]:4); Writeln; END.
USES crt;
Const n=5;
var A:array[1..n] of integer;
i,j,k:integer;
BEGIN
for i:=1 to n do
begin
A[i]:=random(10);
Write(A[i]:4);
end;
for i:=1 to n-1 do
begin
for j := 1 to n-i do
if A[j]>A[j+1] then
begin
k:=A[j];
A[j]:=A[j+1];
A[j+1]:=k
end;
end;
Writeln;
Writeln ('Отсортированный массив по возрастанию: ');
for i := 1 to n do
Write (A[i]:4);
Writeln;
END.