program ideone const 10 array of integer -2 -3 var max integer array o

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
program ideone;
const n=10;
a:array [1..n] of integer=(1,0,5,-2,6,4,-3,8,2,0);
var max,i,k,c,z:integer;
b:array [1..n] of integer;
begin
for i:=1 to n do
b[i]:=a[i];
max:=b[1];
for z:=0 to n-1 do
for i:=1 to n-z do
begin
if max<b[i] then
begin
max:=b[i];
k:=i;
end;
c:=b[n];
b[n]:=max;
b[k]:=c;
end;
for i:= 1 to n do
writeln(' ',b[i]);
end.