VB设计程序【鸡兔同笼】

2024-12-28 12:25:40
推荐回答(2个)
回答1:

Private Sub Command1_Click()
Dim j As Integer '代表鸡的个数
Dim t As Integer ’代表兔的个数
Dim t1 As Integer '腿的个数
For j = 1 To 40
t = 40 - j
t1 = j * 2 + t * 4
If t1 = 100 Then
Print "鸡="; j; "只"; "兔="; t; "只"
End If

Next

End Sub

回答2:

1、tu=40-ji
2、leg=ji*2+tu*4
3、leg=100