Changes

Jump to navigation Jump to search
1 byte added ,  05:46, 11 April 2017
Line 337: Line 337:  
You have a number, or an array or matrix of them, and want to know if any of them is an odd or even number, i.e., their parity.
 
You have a number, or an array or matrix of them, and want to know if any of them is an odd or even number, i.e., their parity.
 
==== Solution ====
 
==== Solution ====
Check the remainder of a division by two. If the remainder is zero, the number is odd.
+
Check the remainder of a division by two. If the remainder is zero, the number is even.
    
   mod (value, 2) ## 1 if odd, zero if even
 
   mod (value, 2) ## 1 if odd, zero if even
Anonymous user

Navigation menu