Find out whether the provided 64 bit integer is an odd number. - CSharp System

CSharp examples for System:Math Number

Description

Find out whether the provided 64 bit integer is an odd number.

Demo Code

// Crystal AI is free software: you can redistribute it and/or modify
using System;//www . j av  a 2  s .  co  m

public class Main{
        /// <summary>
    ///   Find out whether the provided 64 bit integer is an odd number.
    /// </summary>
    /// <param name="number">The number to very whether it's odd.</param>
    /// <returns>True if and only if it is an odd number.</returns>
    public static bool IsOdd(this long number) {
      return (number & 0x1) == 0x1;
    }
        /// <summary>
    ///   Find out whether the provided 32 bit integer is an odd number.
    /// </summary>
    /// <param name="number">The number to very whether it's odd.</param>
    /// <returns>True if and only if it is an odd number.</returns>
    public static bool IsOdd(this int number) {
      return (number & 0x1) == 0x1;
    }
}

Related Tutorials