# Check for EVEN or ODD (8 bits) using 8085 Microprocessor

Here, we are going to check whether a given 8 bits number is EVEN or ODD using 8085 Microprocessor?
Submitted by Shivakshi Dhiman, on October 29, 2018

Problem statement:

To find whether an 8 bits number is even or odd using 8085 Microprocessors.

Given number is EVEN number if its lower bit is 0 i.e. low otherwise number is ODD.

To check whether the number is odd or even, we basically perform AND operation with 01 by using ANI instruction. If number is even then we will get 00 otherwise 01 in accumulator.

We use 11 to represent odd number and 22 to represent even number.

Algorithm:

1. Load the accumulator with the first data.
2. Perform AND operation with 01 on first data using ANI Instruction.
3. Check if zero flag is set then set the value of accumulator to 22 otherwise 11 to accumulator.
4. Now load the result value in memory location.

Program:

```    LDA     2050
ANI     01
JZ **
MVI     A 11
JMP ***
** MVI A 22
***STA 3050
HLT
```

Observation:

```    INPUT:
2050:05
3050:11

OUTPUT:
3052:02
3053:00
```

Hence we successfully find whether 8 bits number is even or odd.

What's New

Top Interview Coding Problems/Challenges!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates