programb47 - Microprocessors & Applications (UPTU) Appendix...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Appendix B ØØ Explanation : GCD of two numbers is performed by dividing the greater number by the smaller number till the remainder is zero. If it is zero, the divisor is the GCD if not the remainder and the divisor of the previous division are the new set of two numbers. The process is repeated by dividing greater of the two numbers by the smaller number till the remainder is zero and GCD is found. Example : First number = 90 Second number = 120 Iteration Operation Remainder 1 120 % 90 30 2 90 % 30 0 Hence, the GCD is 30. ØØ Algorithm : Step I : Initialise the data segment. Step II : Load AX and BX registers with the operands. Step III : Check if the two numbers are equal. If yes goto step X, else goto step IV. Step IV : Is number 1 > number 2 ? If yes goto step VI else goto step V. Step V : Exchange the contents of AX and BX register, such that AX contains the bigger number. Step VI
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/04/2011 for the course ECON 101 taught by Professor Lucky during the Spring '11 term at Silver Lake.

Page1 / 4

programb47 - Microprocessors & Applications (UPTU) Appendix...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online