Dim x As Integer
Dim y As Integer
Dim z As IntegerDo While x <= 33
y = 0
Do While y <= 55
z = 0
Do While z <= 100
If (x + y + z = 100 And 3 * x + 2 * y + 0.5 * z = 100) Then Print x & "," & y & "," & z
z = z + 1
Loop
y = y + 1
Loop
x = x + 1
Loop
Dim a As IntegerDim b As IntegerDim c As IntegerDim i As IntegerFor a = 0 To 33For b = 0 To 50
For c = 0 To 200
If a + b + c = 100 And 3 * a + 2 * b + 0.5 * c = 100 Then
Print a & "," & b & "," & c
End If
NextNextNext
dim x as integerdim y as integerx=0do while x<33y=0do while y<(100-3*x)/2
if 3*x+2*y+(100-x-y)/2-100<0.0001 then
print x,y,100-x-y
endify=y+1loopx=x+1loop1、本程序注意效率本程序两层循环可解决问题,并且第二层不必全部循环到50。2、本程序注意系统计算误差控制,不用两个计算值直接进行相等比较,采用相减差小于某一小值控制。x代表母鸡 y代表公鸡100-x-y代表小鸡