Sub bb() For i = 0 To 10000 aaa i Next End SubSub aaa(intI) Dim i, temp For i = 1 To Len(intI) temp = temp + CInt(Mid(intI, i, 1)) * CInt(Mid(intI, i, 1)) * CInt(Mid(intI, i, 1)) Next If CInt(intI) = CInt(temp) Then Debug.Print intI End Sub 0 1 153 370 371 407
作业题吧~~ dim a as integer , b as integer ,c as integer for a=0 to 9 for b=0 to 9 for c=0 to 9 if a*100+b*10+c=a^3+b^3+c^3 then debug.print cstr(a*100+b*10+c) next next next
For i = 0 To 10000
aaa i
Next
End SubSub aaa(intI)
Dim i, temp
For i = 1 To Len(intI)
temp = temp + CInt(Mid(intI, i, 1)) * CInt(Mid(intI, i, 1)) * CInt(Mid(intI, i, 1))
Next
If CInt(intI) = CInt(temp) Then Debug.Print intI
End Sub 0
1
153
370
371
407
dim a as integer , b as integer ,c as integer
for a=0 to 9
for b=0 to 9
for c=0 to 9
if a*100+b*10+c=a^3+b^3+c^3 then debug.print cstr(a*100+b*10+c)
next
next
next