Test the least significant bit of the number. If it is 1, the number must be odd. If it 0 it must be even. To achieve this, place the value in B then use the ANI instruction:
ANI 01H
Thus if B is 01H, B is odd, otherwise it is even. Works for both positive and negative integers.
Lxi h, 2000h mov a,m mov b,a inx h mov a,m add b sta 2002h hlt
The ORA A instruction does not change the contents of the accumulator. It does, however, set flags to indicate something about the value of the accumulator. In particular, Z means the result is zero, N means it is negative, and P means it has an odd number of ones.
AND it to 1 and test for zero. All even numbers have 0 in the last bit.
27 is an odd number.
An odd number minus an odd number is an even number.
when an odd number is subtracted from an odd number the answer is an even number.
odd
it is an odd number
an odd numberSubtracting an odd number from an even number will always result in an odd number.
An odd number times an odd number is an odd number no matter which 2 odds you multiply.
It is an odd number.
you get an odd number