Программа:
program dividers;
var x, i, p: integer;
y: array of integer;
function dividersOf(n: integer; includeNegative: boolean := false):array of integer;
var a: array of integer;
i, k: integer;
begin
k:= 1;
if(n
for i:= 1 to n
do if(n mod i = 0)
then begin
SetLength(a, k);
a[a.Length-1]:= i;
k:= k+1;
end;
if(includeNegative)
then a:= a.Select(x -> x*(-1)).Sorted.ToArray+a;
dividersOf:= a;
end;
begin
readln(x);
y:= dividersOf(x, true);
p:= y.Length-2;
i:= 0;
writeln('Делители числа ', x, ':');
repeat
write(y[i], ', ');
i:= i+1;
until i=p;
write(y[p+1], '.');
end.