百钱百鸡 VB编程 代码

2020-08-18 教育 196阅读
假设你的百鸡百钱是经典的算法,公鸡5钱,母鸡3钱,3小鸡一钱,下面的代码在VB里面调试通过。
Dim a As Integer, b As Integer, c As Integer
For a = 1 To 20
For b = 1 To 33
c = 100 - a - b
If (a + b + c = 100) And (a * 5 + b * 3 + c / 3 = 100) Then
Print a, b, c
End If
Next b
Next a
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com