{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

programb48

programb48 - Microprocessors Applications(UPTU Appendix B...

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

Microprocessors & Applications (UPTU) 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 : No, is r equal to 1 ? Step XI : Yes, add value n to n C r and return to called program.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 3

programb48 - Microprocessors Applications(UPTU Appendix B...

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

View Full Document
Ask a homework question - tutors are online