输出100以内具有10个以上因子的整数,并输出它的因子

日期:2017-05-05 08:32:04 人气:1

输出100以内具有10个以上因子的整数,并输出它的因子

n可以自己任意换数. 此程序不包括10个因子的,需要的话在判断条件上加上等号即可 n=100; for i=1:n s=1; a=[]; b=[]; c=[]; for j=1:sqrt(i) v=i/j; if v==round(v) a(s)=j; b(s)=v; s=s+1; end end c=[a b]; c=unique(c); if length(c)>10 i disp('它的因子有:'); c end end
    A+
热门评论