青龙山景区:vb中百鸡百钱问题如何输入

来源:百度文库 编辑:中科新闻网 时间:2024/05/08 04:16:40
vb中百鸡百钱问题如何输入呢?

Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer, i As Integer
For a = 1 To 100
For b = 1 To 100
For c = 1 To 100
If a + b + c = 100 And a * 5 + b * 3 + c * 0.5 = 100 Then
i = i + 1
End If
Next c
Next b
Next a
msgbox "有"+ i + "个方案"
End Sub

a=inputbox("a?")
b=inputbox("b?")
c=inputbox("C?")
这样输入就可以了