uses crt;
var i,n,t:integer;
begin
clrscr;
readln(n);
t:=0; i:=1;
while (i<=n) do
begin
if n mod i=0 then t:=t+i;
i:=i+1;
end;
writeln(t);
readln;
end.
Tham khảo:
Uses crt;
Var S, i: integer;
Begin
clrscr;
S : = 0;
i := 1;
while i <= 10 do
begin
S := S + i;
i := i + 1;
end;
writeln (S);
readln;
end.