Actually, there are more interesting points, and some other methods to check is number even. When you use %, you should check your values with 0 as was mentioned by others, because comparing with 1 will give the wrong answer with all negative integers.
bool is_odd(int n) {
return n % 2 == 1; // this method is incorrect for negative numbers
}
bool is_odd(int n) {
return n % 2 != 0;
}
The second popular way is demonstrated below
bool is_odd(int n) {
return x & 1 != 0;
}
This method makes use of the fact that the low bit will always be set on an odd number.
Many people tend to think that checking the first bit of the number is faster, but that is not true for C# (at least). The speed is almost the same and often modulus works even faster.
There is the article where the author tried out all popular ways to check if the number is even and I recommend you to look at the tables that are demonstrated at the bottom of the article.