uses crt; Var S, n, i, j: longint; Begin Write('Nhap so n ='); readln(n); For i:=1 to n do Begin S:=0; For j:=1 to i do if i mod j = 0 then S:=S+j; if S = 2*i then write(i,','); end; readln end.
uses crt; Var S, n, i, j: integer; Begin Write('Nhap so n ='); readln(n); For i:=1 to n do Begin S:=0; For j:=1 to i do if i mod j = 0 then S:=S+j; if S = 2*i then write(i,' '); end; readln end.