Factorial : 8086 ALP

TITLE Factorial of a number
.model small
.stack
.data
num db 5
fact db ?
.code
main proc
    mov ax,@data
    mov ds,ax
    mov si,offset num
    mov al,1
    mov bl,num
    back: mul bl
    dec bl
    jnz back
    mov fact,al
    mov ah,4ch
    int 21h     
main endp
end main

No comments:

Post a Comment