You are currently viewing [PRACTICAL] Implement a program to check whether given no is odd or even
Microprocessor 8085 programming

[PRACTICAL] Implement a program to check whether given no is odd or even

[PRACTICAL] IMPLEMENT A PROGRAM TO CHECK WHETHER GIVEN NO IS ODD OR EVEN

Are you looking for a step-by-step guide to Implement a program to check whether given no is odd or even? here are the steps to implement a program to check whether given no is odd or even.

Theory:

Given no stored in memory location C040h and find number is even or odd. To check no is odd or even we just check last bit of number is LSB bit is 0 then number is even and if LSB bit is 1 then number is odd. To do this we just perform AND operation of accumulator with 01H. If number is even then 01 stored in C050h location and if odd then 01 stored in C051h location.

Program:

LXI H,C040H
MOV A,M
ANI 01h
JNZ odd
MVI a,01h
STA C050h
HLT
odd: STA C051;
HLT

Input:

C040:  45h

Output:

C051: 01h

For more practical related to 885 Programming please visit the 8085 Programming link