作业帮 > 数学 > 作业

VB程序编写假定公鸡每只2元,母鸡每只3元,小鸡每只5角,如果用100元钱买100只鸡,可以买公鸡、母鸡、小鸡数.

来源:学生作业帮 编辑:大师作文网作业帮 分类:数学作业 时间:2024/11/06 06:14:24
VB程序编写假定公鸡每只2元,母鸡每只3元,小鸡每只5角,如果用100元钱买100只鸡,可以买公鸡、母鸡、小鸡数.
VB程序编写假定公鸡每只2元,母鸡每只3元,小鸡每只5角,如果用100元钱买100只鸡,可以买公鸡、母鸡、小鸡各多少只.
VB程序编写假定公鸡每只2元,母鸡每只3元,小鸡每只5角,如果用100元钱买100只鸡,可以买公鸡、母鸡、小鸡数.
Private Sub Command1_Click()
Dim gj As Integer,mj As Integer,xj As Integer
Print "公鸡数","母鸡数","小鸡数"
For gj = 0 To 50
For mj = 0 To 33
For xj = 0 To 200
If gj + mj + xj = 100 And 2 * gj + 3 * mj + 0.5 * xj = 100 Then Print gj,mj,xj
Next xj
Next mj
Next gj
End Su