qualcosa del genere....(non e' testato!)
codice:
var 
 n:integer;
 i:integer;
 media:currency;
 conta:integer;
begin
write('inserisci un numero interno n   ');
readln(n);

conta:=0;
somma:=0;

for i:= 0 to n do
  begin
   if (n mod i)=0 then 
    begin
      conta:=conta+1;
      somma:=somma+i;
    end;
  end;

media:=somma/conta;
ciao