买半只鸡如何?- Option Explicit
- Dim i,j,k,money
- Dim intSum,s
- For i = 1 To 98 step 0.5
- For j = 1 To 98 step 0.5
- k = 100 - (i + j)
- money = i/3 + j*3 + k*5
- If k > 0 And money = 100 Then
- intSum = intSum + 1
- s = s & intSum & ": 小鸡 " & i & " 只,"
- s = s & "公鸡 " & j & " 只,"
- s = s & "母鸡 " & k & " 只" & vbLf
- End If
- Next
- Next
- WScript.Echo s
复制代码
|