how can i cheak the number if it even or odd ? Preferably use (rem) if we can
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
a=5
if rem(a,2)==0
output=even
else
output=odd
end
4 Kommentare
the cyclist
am 14 Mai 2022
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?
Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!