How to find the largest factor of a number using while loops?
1 回表示 (過去 30 日間)
古いコメントを表示
factor cannot be the number we are testing
採用された回答
Bruno Luong
2018 年 11 月 11 日
largestfactor=floor(n/2);
while largestfactor>0
if mod(n,largestfactor)==0
break
end
largestfactor = largestfactor-1;
end
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!