[求助]小弟剛學VB沒多久,老師講課太難懂..不知道各位可不可以幫我看看這道題那裏出
古典數學問題:白錢買百雞,公鷄1錢值5,母雞1錢值3,小雞3只錢值1.何以白錢買百雞?代碼如下:
dim i as integer,j as integer,z as integer
for i =1 to 20 step 1
for j =1 to 33 step 1
for z = 1 to 100 step 1
if (i+j+z=100 and 5*i+3*j+z/3=100) then
print "公鷄數為:":i, "母雞數為:":j, "小雞數為:":z
end if
next z
next j
next
但怎麽都做不出。。。
他說我缺少子程序,函數或屬性....