vb求水仙花数的程序
PrivateSubCommand1_Click()DimsAsIntegerDimaAsIntegerDimbAsIntegerDimcAsIntegers=100Do...
Private Sub Command1_Click()
Dim s As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer
s = 100
Do While s <= 999
a = s \ 100
b = s \ 10 - a * 10
c = s - a ^ 100 - b * 10
If s = a ^ 3 + b ^ 3 + c ^ 3 Then
Print s
End If
s = s + 1
Loop
End Sub
帮我看看哪里有错谢谢。 展开
Dim s As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer
s = 100
Do While s <= 999
a = s \ 100
b = s \ 10 - a * 10
c = s - a ^ 100 - b * 10
If s = a ^ 3 + b ^ 3 + c ^ 3 Then
Print s
End If
s = s + 1
Loop
End Sub
帮我看看哪里有错谢谢。 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询