19 lines
302 B
Text
19 lines
302 B
Text
for n =1 to 10000
|
|
if perfect( n) =1 then print n; " is perfect."
|
|
next n
|
|
|
|
end
|
|
|
|
function perfect( n)
|
|
sum =0
|
|
for i =1 TO n /2
|
|
if n mod i =0 then
|
|
sum =sum +i
|
|
end if
|
|
next i
|
|
if sum =n then
|
|
perfect= 1
|
|
else
|
|
perfect =0
|
|
end if
|
|
end function
|