#You are an input. You have value! You matter!
if number % 2 == 0
return "number is even" (is_num_even = 1 or true)
else
return "number is odd" (is_num_even = 0 or false)
modulo
pseudocode:
plus you’d want an input validation beforehand
who needs modulo when you can get less characters out of
very efficient
edit: or theres the trusty iseven api
here is somewhat less:
return (number % 2) == 0;
are the negative numbers all even?
Yes
🤦
Am I doing it right? /S.
Don’t put nbsps in code blocks, they show up literally.
This code is terrible. If you input 10.66 it returns "number is odd
It should be: