5
(1)

[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

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

As you found this post useful...

Share this post on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?