共回答了20个问题采纳率:95%
Sub Main()
Dim tmp As Integer, i As Integer, j As Integer, k As Integer
For i = 1 To 9
For j = 0 To 9
For k = 0 To 9
tmp = (i * 100 + j * 10 + k)
If tmp = i ^ 3 + j ^ 3 + k ^ 3 Then
Console.Write(Str(tmp) + vbTab)
End If
Next
Next
Next
Console.WriteLine()
Console.ReadKey()
End SubSub Main()
Dim num As Integer, i As Integer, j As Integer, k As Integer
For num = 100 To 999
i = Int(num / 100)
j = Int((num - i * 100) / 10)
k = num - i * 100 - j * 10
If i ^ 3 + j ^ 3 + k ^ 3 = num Then Console.Write(Str(num) + vbTab)
Next
Console.WriteLine()
Console.ReadKey()
End Sub
153,370,371,407
1年前
追问
5
你是在什么环境下,在vs2013下,两个我都运行通过
win7 vb 显示中间有错误
错误信息是什么?
Console.WriteLine()
Console.ReadKey()
显示编译错误缺少 =
你把这两条语句注释掉