programb48 - Microprocessors & Applications (UPTU)...

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

View Full Document Right Arrow Icon
Appendix B ØØ Explanation : The recursive procedure n C r can be evaluated by different ways. One method to find the factorial of n, (n – r) and r evaluating it by n C r = In order to reduce the time of execution, we will alter the logic. If r = 0 or r = n , n C r = 1 If r = 1 or r = (n – 1) n C r = n. For all other cases we will compute it as, n C r = (n – 1) C r + (n –1) C r –1. ØØ Algorithm : Step I : Initialize the data memory with n and r value whose n C r is to be found. Step II : Initialize memory to save n C r result. Step III : Load AX with n and BX with r. Step IV : Call the function to find n C r . Step V : Terminate the program Procedure n C r . Step VI : Are n and r equal ? Step VII : Yes, save 01 in n C r and return to called program. Step VIII : No, is r equal to 0 ? Step IX : Yes, save 01 in n C r and return to called program. Step X
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 / 3

programb48 - Microprocessors & Applications (UPTU)...

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