Task

Test whether an integer is even or odd.

There is more than one way to solve this task:

 Use the even and odd predicates, if the language provides them.
 Check the least significant digit. With binary integers, i bitwise-and 1 equals 0 iff i is even, or equals 1 iff i is odd.
 Divide i by 2. The remainder equals 0 iff i is even. The remainder equals +1 or -1 iff i is odd.
 Use modular congruences:
 i ≡ 0 (mod 2) iff i is even.
 i ≡ 1 (mod 2) iff i is odd.


[ Even or odd
  ===========
 
  A program for the EDSAC
 
  Determines whether the number stored at
  address 15@ is even or odd, and prints
  'E' or 'O' accordingly
 
  Works with Initial Orders 2 ]
 
       T56K   [ load point ]
       GK     [ base address ]
 
       O11@   [ print letter shift ]
       T10@   [ clear accumulator ]
       H15@   [ multiplier := n ]
       C12@   [ acc +:= mult AND 1 ]
       S12@   [ acc -:= 1 ]
       G8@    [ branch on negative ]
       O14@   [ print 'O' ]
       ZF     [ halt ]
[ 8 ]  O13@   [ print 'E' ]
       ZF     [ halt ]
 
[ 10 ] P0F    [ used to clear acc ]
[ 11 ] *F     [ letter shift character ]
[ 12 ] P0D    [ const: 1 ]
[ 13 ] EF     [ character 'E' ]
[ 14 ] OF     [ character 'O' ]
[ 15 ] P18D   [ number to test: 37 ]
 
       EZPF   [ branch to load point ]