How to

find out whether number is odd/even number

Published: 3. November 2011 | Updated: 3. November 2011
License: Microsoft Public License (MS-PL)
Categories: Framework » Math
Tags: C# Math
Was this snippet helpful for you? YESYES / NONO
public static bool IsOddNumber(int number)
{
    return number % 2 != 0;
}

public static bool IsEvenNumber(int number)
{
    return number % 2 == 0;
}
Send us feedback about this snippet »



Related Snippets: