我想使用此代码找到小于 8 的数字的阶乘。但这不起作用,谁能帮帮我?这是我的家庭作业。我试过了,但它又打印了相同的字符,而且是 agian ..
.model small_
.stack_
.data_
no db 1h_ ;
counter db 1_
string1 db "Please Enter the No. to calculate factorial (0~8): ","$"
string2 db "Factorial is: ","$"
.code
main proc
mov ax,@data
mov ds,ax
mov dx,offset string1
mov ah,09h
int 21h
mov cl,1
loop1:
cmp counter,3
ja End1
mov ah,01h
int 21h
sub al,48
inc counter
mov no,al
cmp no,8
ja loop1
Factorial:
cmp no,cl
je display
mul al,cl
inc cl
jmp factorial
Display:
mov ax,@data
mov ds,ax
mov dx,offset string2
mov ah,09
int 21h
mov dl,al
add dl,48
mov ah,02h
int 21h
End1:
mov ah,4ch
int 21h
main endp
**_End main _**