You can check for a remainder existing when dividing the integer by 2 to see if it is odd or even. So for a whole array you could do the following:
//where test is int[]
Test.All(i => (i % 2) == 0)); // check for even
Test.All(i => (i % 2) > 0)); // check for odd
No comments:
Post a Comment