# 8086 program to find the square root of a perfect square root number | Set-2

Prerequisite – 8086 program to find Square Root of a number

**Problem –** Write a program to find the square root of a perfect number where starting address for code is **2000** and number is stored at **3000** memory address and store result into **3002** memory address.

**Example –**

**Algorithm –**

- Move 0000 to register CX immediately
- Move value of memory 3000 into register BX
- Move CX into AX
- Multiply value of accumulator with CX
- Compare AX with BX
- Jump if zero to step
- Increase CX register by 1
- Jump if no zero to step 3
- Move content of register CX into memory 3002
- Stop

**Program –**

Memory | Mnemonics | Operands | Comment |
---|---|---|---|

2000 | MOV | CX, 0000 | [CX] <- 0000 |

2003 | MOV | BX, [3000] | [BX] <- [3000] |

2007 | MOV | AX, CX | [AX] <- [CX] |

2009 | MUL | CX | [AX] <- [AX] * [CX] |

200B | CMP | AX, BX | [AX] – [BX] |

200D | JZ | 2015 | Jump if zero |

2010 | INC | CX | [CX] <- [CX] + 1 |

2012 | JNZ | 2007 | Jump if not zero |

2015 | MOV | [3002], CX | [3002] <- CX |

2019 | HLT | Stop |

**Explanation –** Registers AX, BX, CX, are used for general purpose.

**MOV**is used to transfer the data**INC**is used to increase given register by 1**JNZ**is used to jump to the given step if their is no zero**JZ**is used to jump to the given step if their is zero**MUL**is used to multiply value of AX with the given register**CMP**is used to compare the value of two registers**HLT**is used to halt the program

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: **DSA Self Paced**. Become industry ready at a student-friendly price.

## Recommended Posts:

- 8086 program to find Square Root of a number
- 8085 program to find square root of a number
- 8085 program to find square of a 8 bit number
- 8086 program to find the factorial of a number
- 8086 program to find sum of digits of 8 bit number
- How to bind to port number less than 1024 with non root access?
- 8086 program to find the min value in a given array
- 8086 program to find sum of odd numbers in a given series
- 8086 program to find sum of Even numbers in a given series
- 8086 program to find average of n numbers
- 8086 program to find GCD of two numbers and print the GCD
- 8086 program to convert an 8 bit BCD number into hexadecimal number
- 8086 program to convert 8 bit ASCII to BCD number
- 8086 program to search a number in a string
- 8086 program to reverse 16 bit number using 8 bit operation
- 8086 program to Print a 16 bit Decimal number
- 8086 program to reverse 8 bit number using 8 bit operation
- 8086 program to convert a 16 bit decimal number to binary
- 8086 program to convert a 16 bit Decimal number to Octal
- 8086 program to convert a 16 bit decimal number to Hexadecimal

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.