How To find a number is odd or even in 8085?

1 answer

Answer

1127240

2026-08-02 18:40

+ Follow

every odd no. has "1" in its last bit and every even no has "0" (in binary)

eg-

2=0010 ,3=0011

4=0100 ,5=0101....and so on

so just logically "AND" the no with "01H" using instruction [HAVING THAT NO. IN ACCUMULATOR (A)]

ANI 01H

so if the no. is even =>

A=0 (and zero flag is set i.e. "1"

but if the no is odd then => A=1

means zero flag is reset i.e. "0"

so using instruction "JZ"

you can find if the no. if even or odd. :)

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.