# 8085 program to check whether the given number is even or odd

In this program we will see how to check whether a number is odd or even.

### Problem Statement

Write 8085 Assembly language program to check whether a number is odd or even.

### Discussion

The Odd Even checking is very simple. we can determine one number is odd or even by checking only the LSb. When LSb is 1, the number is odd, otherwise it is even.In this program we are taking a number from memory and then ANDing 01H with it. if the result is nonzero, then the number is odd, otherwise it is even.

first input

Data
.
.
.
.
.
.
8000
15
.
.
.
.
.
.

second input

Data
.
.
.
.
.
.
8000
2C
.
.
.
.
.
.

### Program

HEX Codes
Label
Mnemonics
F000
3A, 00, 80

LDA 8000H
F003
E6, 01

ANI 01H
AND 01H with Acc content
F005
CA, 0D, F0

JZ EVEN
If Z = 0, it is Even
F008
3E, 01

MVI A, 01H
Load 01H to indicate it is Odd
F00A
C3, 0F, F0

JMP STORE
F00D
3E, FF
EVEN
MVI A, FFH
Load FFH to indicate it is Even
F00F
32, 50, 80
STORE
STA 8050H
Store the result into memory
F012
76

HLT
Terminate the program

first input

Data
.
.
.
.
.
.
8000
01
.
.
.
.
.
.

second input

Data
.
.
.
.
.
.
8000
FF
.
.
.
.
.
.