Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var a:array[1..10] of integer;
- i,j,temp:integer;
- begin
- for i:=1 to 10 do
- begin
- a[i] := random(100);
- if i = 6 then write(' |');
- write(a[i]:4);
- end;
- writeln;
- for i:=1 to 5 do
- for j:=1 to i do
- begin
- if (a[i] < a[j]) and (i <> j) then
- begin
- temp := a[i];
- a[i] := a[j];
- a[j] := temp;
- end;
- end;
- ////////
- for i:=6 to 10 do
- for j:=6 to 10 do
- begin
- if (a[i] > a[j]) and (i <> j) then
- begin
- temp := a[i];
- a[i] := a[j];
- a[j] := temp;
- end;
- end;
- for i:=1 to 10 do
- begin
- if i = 6 then write(' |');
- write(a[i]:4);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment