问道魂兽石:QBASIC高手请赐教

来源:百度文库 编辑:高校问答 时间:2024/04/29 02:40:28
某班开联欢会,需买瓜子、花生和糖果,已知瓜子2元/包、花生3元/包、糖果4元/包,计算用N元正好买M包东西的采购方法

input "money =";n
input "how many =";m
for a=1 to m
for b=1 to m-x
c=m-a-b
if n=2*a+3*b+4*c then
print "a=";a,"b=";b,"c=";c
end if
next
next