我是matlab初学者 这个程序看不懂.第一个break有什么用啊第二个break不是一直都在运行吗?i=1;while i>0if rem(100-i*2,4)==0&(i+(100-i*2)/4)==36break;endi=i+1;n1=i;n2=(100-2*i)/4;breakendfprintf('the number of chicken is %d.\n

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/03 00:39:07
我是matlab初学者 这个程序看不懂.第一个break有什么用啊第二个break不是一直都在运行吗?i=1;while i>0if rem(100-i*2,4)==0&(i+(100-i*2)/4)==36break;endi=i+1;n1=i;n2=(100-2*i)/4;breakendfprintf('the number of chicken is %d.\n

我是matlab初学者 这个程序看不懂.第一个break有什么用啊第二个break不是一直都在运行吗?i=1;while i>0if rem(100-i*2,4)==0&(i+(100-i*2)/4)==36break;endi=i+1;n1=i;n2=(100-2*i)/4;breakendfprintf('the number of chicken is %d.\n
我是matlab初学者 这个程序看不懂.第一个break有什么用啊第二个break不是一直都在运行吗?
i=1;
while i>0
if rem(100-i*2,4)==0&(i+(100-i*2)/4)==36
break;
end
i=i+1;
n1=i;
n2=(100-2*i)/4;
break
end
fprintf('the number of chicken is %d.\n',n1);
fprintf('the number of rabbit is %d.\n',n2);

我是matlab初学者 这个程序看不懂.第一个break有什么用啊第二个break不是一直都在运行吗?i=1;while i>0if rem(100-i*2,4)==0&(i+(100-i*2)/4)==36break;endi=i+1;n1=i;n2=(100-2*i)/4;breakendfprintf('the number of chicken is %d.\n
你的程序有问题,其有效成分仅仅如下:
i=1;
i=i+1;
n1=i;
n2=(100-2*i)/4;
fprintf('the number of chicken is %d.\n',n1);
fprintf('the number of rabbit is %d.\n',n2);
从上面看你并没有解决鸡兔同笼问题.
以下是按照你的程序修改的
clear;
clc;
i=1;
while i>0
if rem(100-i*2,4)==0&(i+(100-i*2)/4)==36
n1 = i;
n2 = (100-2*i)/4;
break;
end
i=i+1;
end
fprintf('the number of chicken is %d.\n',n1);
fprintf('the number of rabbit is %d.\n',n2);
结果:
the number of chicken is 22.
the number of rabbit is 14.
当然也可以不用这么复杂,可以采用以下程序:
[n1,n2] = solve('2*x+4*y-100','x+y-36'); %%%求解个方程组就成
fprintf('the number of chicken is %d.\n',double(n1));
fprintf('the number of rabbit is %d.\n',double(n2));

我是matlab初学者 这个程序看不懂.第一个break有什么用啊第二个break不是一直都在运行吗?i=1;while i>0if rem(100-i*2,4)==0&(i+(100-i*2)/4)==36break;endi=i+1;n1=i;n2=(100-2*i)/4;breakendfprintf('the number of chicken is %d. 这个图是什么.我是初学者 谁懂易经?因为我是一个初学者...很多都看不懂! matlab初学者,程序不懂!y(i)=sin(n(i)); C=triu(A,3) matlab上看见噶,初学者. 求两个整数的最大公约数和最小公倍数这个程序用C++怎么编?因为我只是一个初学者,否则我要看不懂的. matlab 编写一个M文件,任意输入半径,程序输出该半径圆的面积和球的体积!可是我是初学者啊,能否把该程序各给详细说一下! 我是MATLAB初学者,求MATLAB大神帮忙运行程序.源程序素材我我都有 就是不知道怎么运行起来 大神可以留下联系方式传给你,帮忙解决 matlab plot 提示错误:Vectors must be the same lengths!大侠们好,我是一位初学者,但由于工作需要一个编程,这个程序一运行到plot的时候就会出现错误提示.可我不知道怎么才能改正.麻烦大侠们帮帮忙! 我是初学者, 我是初学者 我是matlab初学者,我想问问如何用matlab画中国地图啊, 如果告诉你a,b,c三条边,判断是否可以构成三角形,如果能计算出这个三角形的面积和周长.java程序怎么写我是初学者! matlab有关问题这个题是画一个圆,我不明白f=x+y*i及下面的是什么意思,还有axis函数的用法,我是初学者. MATLAB中如何对连续函数进行采样,然后把采样值保存到一个数组中?比如sin(2*pi*50*t),采样频率为1000.最好有注释,我是初学者,不然看不懂. 这个C++程序是做什么的?我是个初学者,#include //这边程序很不理解;using namespace std;templateclass stack{public:stack();bool isnotempty();private:T sz[num];int point;};template stack::stack(){point=0; }template bool stack::isno 魔方六面的口诀简单点我是初学者,复杂的看不懂 65336=FF38H如何计算,我是初学者,书上也没写看不懂啊! 请问程序该怎么写啊,我是初学者.越简单越好,谢啦~*^_^*