求三位数中,个位数字与十位数字之和除以10所得的余数是百位数字,且百位数字是奇数的数的和。
Private Sub Form_click()
Dim s As Integer
Dim x As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer
s = 0
x = 100
Do While x <= 999
a = Int(x / 100)
b = Int(x / 10) - a * 10
c = x - a * 100 - b * 10
If Then s = s + x
x = x + 1
Loop
Print s
End Sub
求所有水仙花数之和(所谓水仙花数是指一个三位十进制数,该数的各位数字立方之和等于该数本身。例如371是一个水仙花数,因为3^3+7^3+1^3=371)。
Private Sub Command1_Click()
For a = 1 To 9
For b = 0 To 9
For c = 0 To 9
n = a * 100 + b * 10 + c
m = a * a * a + b * b * b + c * c * c
If ____________ Then
s = s + n
End If
Next c
Next b
Next a
Print s
End Sub