编辑代码

function calculaterabbit(A,B)

	a=-0.5
	b=2.0
	c=0.5
	d=-1.0
	
	rabbit=c*A+d*B
	
	
	
	return rabbit
end

	print("please input the number of foot")
	A=io.read("*n")
	print("please input the number of head")	
	B=io.read("*n")
	rabbit=calculaterabbit(A,B)
	chicken=B-rabbit
    if(chicken>=0.01 and rabbit>=0.01 and (rabbit%1)==0 and (chicken%1)==0)
	then
    print("the number of rabbit is ",rabbit," , and the number of chicken is ", chicken)
    else
    print("error")
    end