9.目前世界上人口为60亿,如果以每年1.4%的速度增长,n(n为正整数)年后世界人口达到80亿,求n。
Private Sub command1_Click()
Dim p As Single
Dim r As Single
Dim n As Integer
FontSize = 14: FontBold = True
p = 60
r = 0.014
n = 0
Do
n = n + 1
Loop Until p >= 80
Print n
End Sub
10.求三位数中,个位数字与十位数字之和除以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 + 1
x = x + 1
Loop
Print s
End Sub
11.求三位数中,个位数字与十位数字之和除以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
12.求所有水仙花数之和(所谓水仙花数是指一个三位十进制数,该数的各位数字立方之和等于该数本身。例如371是一个水仙花数,因为33+73+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
13.求整数[2335,4321]之间即不能被3整除,又不能被5整除的奇数的个数。(530)
Private Sub Command1_Click()
Dim i As Integer, n As Integer
n = 0
For i = 2335 To 4321 Step 2
If Then
n = n + 1
End If
Next i
Print n
End Sub
以后有类似的问题也可以找我