鸡兔同笼MATLAB程序问题

来源:百度知道 编辑:UC知道 时间:2024/06/28 03:06:22
i=1;
while i>0
if rem(100-i*2,4)==0&(i+(100-2*i)/4)==36
fprintf('the num of chicken is %d.\n',i);
break;
end;
i=i+1;
break;
end;
为什么没有任何结果????????
;到底怎么回事?可加可不加 对结果没影响吗????

多打了一句break(最后那个break多余)
改成
======================================
i=1;
while i>0
if rem(100-i*2,4)==0&(i+(100-2*i)/4)==36
fprintf('the num of chicken is %d.\n',i);
break;
end;
i=i+1;
end;