Test for an Even or Odd Value
using System; using System.Data; class Class1{ static void Main(string[] args){ Console.WriteLine(IsEven(0)); Console.WriteLine(IsEven(3)); Console.WriteLine(IsOdd(2)); Console.WriteLine(IsOdd(1)); } public static bool IsEven(int intValue) { return ((intValue & 1) == 0); } public static bool IsOdd(int intValue) { return ((intValue & 1) == 1); } }