programb45 - 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 : To compute the factorial of a number means to multiply the number n with (n – 1) (n – 2) …. × 2 × 1. e.g. to compute 5 ! 5! = 5 × 4 × 3 × 2 × 1 = 120. In our program, we will initialize AX = 1 and load the number whose factorial is to be computed in BX. Call recursive procedure fact, which will calculate the factorial of the number. Display the result.  Algorithm : Step I : Initialize the data segment. Step II : Initialize AX = 1. Step III : Load the number in BX. Step IV : Call procedure fact. Step V : Compare BX with 1, if not goto step 7. Step VI : AX = 1 and return back to calling program. Step VII : Fact = AX × BX. Step VIII : Decrement BX. Step IX : Compare BX with 1, if not goto step 7. Step X : Return back to calling program. Step XI : Display the result. Step XII : Stop.  Flowchart : Refer flowchart 45.  Program :
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

programb45 - 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