Function HH(a: longint):boolean; Var s,i: longint; Begin s:=0; For i:=1 to a div 2 do If a mod i = 0 then s:=s+i; If s=a then exit(true); exit(false); End;
Begin Clrscr; Write(‘Nhap n: ‘); Readln(n); For i:=1 to n do If HH(i) then Write(i:5); Readln End.
program hotboy;
uses crt;
var i,n,s,j: integer;
begin
clrscr;
s:=0;
write(‘nhap so n tu ban phim’); readln(n)
for i:=1 to n do
begin
for j:=1 to i do
if i mod j=0 then s:=s+j;
if s=2*i then
write(‘so hoan chinh nho hon n la’,i:2:2);
end;
readln
end.
Program SHH;
Uses crt;
Var n,i: longint;
Function HH(a: longint):boolean;
Var s,i: longint;
Begin
s:=0;
For i:=1 to a div 2 do
If a mod i = 0 then s:=s+i;
If s=a then exit(true);
exit(false);
End;
Begin
Clrscr;
Write(‘Nhap n: ‘); Readln(n);
For i:=1 to n do
If HH(i) then Write(i:5);
Readln
End.