首页 > 代码库 > 小小递归程序

小小递归程序

求n的阶乘,键盘输入n,结果存储在AX中。

 1 DATA SEGMENT 2  3 DATA ENDS 4 STACK1 SEGMENT STACK 5     DB 50H DUP(0) 6 STACK1 ENDS 7 CODE SEGMENT 8     ASSUME CS:CODE,DS:DATA,SS:STACK1 9 START:  MOV AX,DATA10     MOV DS,AX11     MOV AH,1    ;INPUT (AL)12     INT 21H13     XOR AH,AH14     SUB AL,30H15     MOV DX,116     CALL DIGUI17         MOV AH,4CH    ;RETURN DOS18     INT 21H19 DIGUI   PROC    NEAR20         CMP AL,021     JE RET122     PUSH AX23     DEC AL24     CALL DIGUI25     POP AX26     MUL DL27     MOV DX,AX28 RET1:   RET29 DIGUI   ENDP30 CODE ENDS31     END START32     
View Code

 

小小递归程序