题库 高中信息

题干

完全数又称完美数或完备数,指它所有的真因子(即除了自身以外的约数)的和恰好等于它本身,例如6=1+2+3。完成下列程序,查找并输出1000以内的完全数。

程序中划线处应填入的语句是(1)____________ ___ (2)__________________
Private sub command1_click
Dim  n as integer
Dim  i as integer
Dim  s as integer
For n="2" to 1000
S=0
For i="1" to n\2
If ____(1)_____   then s=s+i
Next i
If s=n  then  list.AddItem  str(n)
__(2)______
End sub
上一题 下一题 0.99难度 填空题 更新时间:2016-12-14 12:25:11

答案(点此获取答案解析)