Browse - programming tips - c isodd isevenDate: 2008jan17 Language: C/C++ Level: Beginner Q. What's the nicest way to test if a number is odd or even in C/C++ ? A. I think this pair of functions is about as nice as you can get: inline bool isodd(const int n) { return n % 2; } inline bool iseven(const int n) { return !isodd(n); } Add a commentSign in to add a comment |