how do i let my code know to check for whether a number is even or odd?
3 Likes
mb something like this?
if the remainder you get when you divide a number by 2 is 1, then it is odd. (3/2 has a remainder of 1)
if the remainder you getwhen you divide a number by 2 is 0, then it is even. (4/2 has no remainder)
3 Likes
The best way I know of is to use the remainder of / block. It implements something called modulo arithmetic. Think about it and experiment till you figure out how to use it.
2 Likes