题型:综合题 题类:常考题 难易度:普通
浙江省高中信息技术 枚举算法及程序实现同步练习
请回答以下问题。
Private Sub Command1_Click()
Dim i As Integer, n As Integer
Dim s As Integer 's为A类数的个数
Dim t As Integer 't为二进制数中“1”的个数
Dim k As Integer 'k为二进制数中“0”的个数
s=0
For i=1 To 1000
n=i:t=0:k=0
Do While n > 0
If Then t=t+1 Else k=k+1
Loop
If t>k Then
List1.Additem str(i)
s=s+1
End If
Next i
Text1.Text=Str(s)
End Sub
试题篮