matlab:怎样编写找出所有由1-9九个数字组成的式子,满足:一个三位数减去另一个三位数等于另一个三位数
人气:401 ℃ 时间:2019-09-02 09:40:34
解答
for num1=100:999
for num2=100:999
num3=num1-num2;
if(num3999),continue;end
temp=strcat(num2str(num1),num2str(num2),num2str(num3));
flag=1;
for cnt1=1:length(temp)-1
for cnt2=cnt1+1:length(temp)
if(any(temp=='0',2)),flag=0;break,end
if(temp(cnt1)==temp(cnt2)),flag=0;break,end
end
if(flag==0),break,end
end
if(flag==1),fprintf('%d-%d=%d\n',num1,num2,num3);end
end
end
推荐
猜你喜欢
- The colorful T-shirt is beautiful but it is not c____for me
- 着么证明5加6等于11
- 下列河流中,最终注入印度洋的是( ) A.鄂毕河 B.叶尼塞河 C.黄河 D.恒河
- 秋词和天净沙秋思这两种不同的情感是怎样表现出来的求大神帮助
- 找规律.1,2,4,6,7,10,10,( )().1,2,3,5,8,13()()
- 英语翻译
- 将0.53g Na2CO3溶于40mL水中,与20mL盐酸溶液恰好完全反应.求该盐酸溶液中HCl的物质的量浓度.
- Dragons seem m________.None of us has seen them.