Learn Computer Science programming - C# and C++ Algorithms

 
Odd or even?
Determine if a given integer is an odd or an even number.
Code
 
// Determine if n is an odd number    
    if (n & 1 == 1) 
        . . . 
    else 
        . . . 

// Make n an even number
    n = n & 0xFFFE; 

// Make n an odd number
    n = n |0x0001;