Saturday, 18 March 2017

8086 Program to find the factorial of a number( input and output specification)

                                                 FACTORIAL OF A NUMBER 

AIM : To find the factorial of a number

PROGRAM :


ADDRESS LABEL MNEMONICS DESCRIPTION
1000 MOV SI,2000 MOVE 2000 INTO SI
1004 MOV BX,[SI] MOVE THE CONTENT OF SI TO BX
1006 MOV AX,01 MOVE 0001 INTO AX
100A L1 MUL BX MULTIPLY AX WITH BX/td>
100C DEC BX DECREMENT BX
100D JNZ L1 JUMP IF NON-ZERO TO LABEL1
100F MOV DI,2002 MOVE 2002 INTO DI
1013 MOV [DI],AX MOVE CONTNT OF AX INTO LOCN SPCIFED IN DI
1015 HLT STOP


INPUT :                                      OUTPUT :

[2000] : 0004                          [2002] : 0018 // 0018 is the hexadecimal value of 24

No comments:

Post a Comment