model small
.data
x db "enter a no. $"
y db "factorial $"
.code
.startup
mov ah,09h
lea dx,x
int 21h
mov ah,01h
int 21h
sub al,30h
mov bl,0ah
mul bl
mov bl,al
mov ah,01h
int 21h
sub al,30h
add al,bl
mov ah,09h
lea dx,y
int 21h
mov bl,al
l:
dec bl
mul bl
cmp bl,01h
jne l
mov ah,09h
lea dx,y
int 21h
cmp al,64h
jl l2
mov ch,al
mov bh,0ah
div bh
mov dh,ah
div bh
mov dl,al
add dl,30h
mov ah,02h
int 21h
mov dl,ah
add dl,30h
mov ah,02h
int 21h
mov dl,dh
add dl,30h
mov ah,02h
int 21h
jmp e
l2:
mov bh,0ah
div bh
mov dl,al
add dl,30h
mov ah,02h
int 21h
mov dl,ah
add dl,30h
mov ah,02h
int 21h
e:
.exit
end