编写函数,输出1000以内的所有完数及其因子
发布网友
发布时间:2023-10-19 20:44
我来回答
共1个回答
热心网友
时间:2024-12-03 02:01
Dim i As Integer
Dim j As Integer
Dim IntSum As Integer
For i = 1 To 1000
intSum = 0
For j = 1 To Int(i / 2)
If i Mod j = 0 Then intSum = intSum + j
Next j
If intSum = i Then Print i
Next i