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!