# 8085 program to find smallest number between two numbers

**Problem –** Write an assembly language program to find ** smallest number ** between two number’s.

**Example –**

**Algorithm –**

- Load the content from memory location
- Move content of
**Accumulator**into**Register**B - Load the content from
**Memory location** - Compare the content of
**Register**B - If carry flag is equal to 1 go to step 7
- Move content of
**Register**B into**Accumulator** - Store the content into
**Memory** - End of program

**Program –**

Memory | Memonics | Use Operand | Comments |
---|---|---|---|

2000 | LDA | [2500] | [A]<-[2500] |

2003 | MOV B, A | [B]<-[A] | |

2004 | LDA | 2501 | [A]<-[2501] |

2007 | CMP B | [A]<-[A]-[B] | |

2008 | JC * | [200C] | jump carry |

200B | MOV B, A | [A]<-[B] | |

200C | STA | [2502] | [A]->[2502] |

200F | HLT | STOP |

**Explanation –**

- LDA is used to load accumulator (3 Byte instruction).
- CMP is used to compaire the content of accumulator (1 Byte instruction).
- STA is used to store accumulator direct using 16-bit address (3 Byte instruction).
- JC jump if carry (3 Byte instruction).

## Recommended Posts:

- 8085 program to find the sum of first n natural numbers
- 8085 program to find larger of two 8 bit numbers
- 8085 program to find maximum of two 8 bit numbers
- 8085 program to find the sum of series of even numbers
- 8085 program to find maximum and minimum of 10 numbers
- 8085 program to search a number in an array of n numbers
- 8085 program to find sum of digits of 8 bit number
- 8085 program to find the factorial of a number
- 8085 program to find 1’s and 2’s complement of 16-bit number
- 8085 program to find nth power of a number
- 8085 program to find 1's and 2's complement of 8-bit number
- 8085 program to find square of a 8 bit number
- 8085 program to find minimum value of digit in the 8 bit number
- 8085 program to find square root of a number
- 8085 program to count total even numbers in series of 10 numbers

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.