How do I find all odd numbers between 1 and 60 but are divisible by 5?
4 ビュー (過去 30 日間)
古いコメントを表示
How do I find all odd numbers between 1 and 60 but are divisible by 5 using the for loop?
回答 (1 件)
Walter Roberson
2023 年 10 月 21 日
hint:
for i = 1 : 60
r7 = remainder7(i);
if r7 == 0; disp(i); end
end
function v = remainder7(v)
while v >= 7
v = v - 7;
end
end
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!