how can i cheak the number if it even or odd ? Preferably use (rem) if we can
조회 수: 1 (최근 30일)
이전 댓글 표시
a=5
if rem(a,2)==0
output=even
else
output=odd
end
댓글 수: 4
the cyclist
2022년 5월 14일
In your code, you set a equal to 5. So, you want your code to "tell" you that that is an odd number. But, what do you want the program to do?
- Output the string "odd"?
- Output the string "a is an odd number"?
- Output the string "5 is an odd number"?
All of these things are easy to do. What do you need?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!