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!