Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- n,i:byte;
- a,t:array[1..10] of integer;
- j:integer;
- begin
- repeat
- write('N = '); readln(n);
- until (n>1) and (n<11);
- for i:=1 to n do
- repeat
- write('a[',i,'] = '); readln(a[i]);
- until (a[i]<>0) and (abs(a[i])<30001);
- for i:=1 to n do
- t[i]:=0;
- if a[i]>0 then begin
- for j:=1 to a[i] do
- if a[i] mod j=0 then t[i]:=t[i]+j;
- end else begin
- for j:=-1 downto a[i] do
- if a[i] mod j=0 then t[i]:=t[i]+j;
- end;
- for i:=1 to n do
- write(t[i],' ');
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement