- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# 8085 program to count total even numbers in series of 10 numbers

In this program we will see how to count number of even numbers in a block of elements.

### Problem Statement

Write 8085 Assembly language program to count number of even numbers in a block of data, where the block size is 10D. The block is starting from location8000H.

### 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 ANDing01H with it. if the result is nonzero, then the number is odd, otherwise it is even.

### Input

Address | Data |
---|---|

. . . | . . . |

8000 | DA |

8001 | 53 |

8002 | 26 |

8003 | 41 |

8004 | 17 |

8005 | AC |

8006 | 78 |

8007 | D8 |

8008 | 9C |

8009 | 3F |

. . . | . . . |

### Flow Diagram

### Program

Address | HEX Codes | Labels | Mnemonics | Comments |
---|---|---|---|---|

F000 | 21, 00, 80 | LXI H,8000H | Point to the starting byte | |

F003 | 0E, 0A | MVI C,0AH | Initialize count to 0AH | |

F005 | 06, 00 | MVI B, 00H | Clear B register | |

F007 | 7E | LOOP | MOV A,M | Load the item from memory |

F008 | E6, 01 | ANI 01H | AND A with01H | |

F00A | C2, 0E, F0 | JNZ SKIP | If Z = 1, jump to skip | |

F00D | 04 | INR B | Increase B by1 | |

F00E | 23 | SKIP | INX H | Point to next location |

F00F | 0D | DCR C | Decrease C by1 | |

F010 | C2, 07, F0 | JNZ LOOP | if Z = 0, goto loop | |

F013 | 78 | MOV A, B | Load the count to A | |

F014 | 32, 50, 80 | STA 8050H | Store the result at 8050H | |

F017 | 76 | HLT | Terminate the program |

### Output

Address | Data |
---|---|

. . . | . . . |

8050 | 06 |

. . . | . . . |

- Related Articles
- 8085 program to count total odd numbers in series of 10 numbers
- 8085 program to find the sum of series of even numbers
- 8086 program to find sum of Even numbers in a given series
- 8085 program to find maximum and minimum of 10 numbers
- Python program to Count Even and Odd numbers in a List
- Count subsets having distinct even numbers in C++
- Find the count of maximum contiguous Even numbers in C++
- 8085 program to add numbers in an array
- 8085 program to add 2-BCD numbers
- 8085 program to subtract two BCD numbers
- Program to count total number of set bits of all numbers in range 0 to n in Python
- Java Program to Find Sum of First N Odd numbers and Even numbers
- 8085 program to convert binary numbers to gray
- Find the mean of first 10 even natural numbers.
- 8085 Program to Add two 8 Bit numbers

Advertisements