Program arra; const m=20; var B: Array[1..m] Of Integer; i,j,k:integer; BEGIN randomize; for i:=1 to m do begin B[i]:= random(101); end;
write('Массив до сортировки: '); for i:=1 to m do begin write(B[i]); write(' '); end; writeln; for i := 1 to m-1 do for j := 1 to m-i do if B[j] < B[j+1] then begin k := B[j]; B[j] := B[j+1]; B[j+1] := k end; write('Массив после сортировки: '); for i:=1 to m do begin write(B[i]); write(' '); end; end.
const m=20;
var
B: Array[1..m] Of Integer;
i,j,k:integer;
BEGIN
randomize;
for i:=1 to m do begin
B[i]:= random(101);
end;
write('Массив до сортировки: ');
for i:=1 to m do begin
write(B[i]);
write(' ');
end;
writeln;
for i := 1 to m-1 do
for j := 1 to m-i do
if B[j] < B[j+1] then begin
k := B[j];
B[j] := B[j+1];
B[j+1] := k
end;
write('Массив после сортировки: ');
for i:=1 to m do begin
write(B[i]);
write(' ');
end;
end.