division a number and print reminder in Assembly language
.model small
.stack 100h
.code
start:
mov ah,1h ; User input 1
int 21h
sub al,30h ; ascii to Hexa
mov bh,al
mov ah,1h ; User input 2
int 21h
sub al,30h; ascii to Hexa
mov ah,0 ;change ah value as 0
div bh
mov dl,al
add dl,30h ; Hexa to ascii
mov bl,ah
mov ah,2h ;print
int 21h
mov dl,bl
add dl,30h ; Hexa to ascii
mov ah,2h ;print
int 21h
mov ah,4ch ;terminate code
int 21h
end start
.stack 100h
.code
start:
mov ah,1h ; User input 1
int 21h
sub al,30h ; ascii to Hexa
mov bh,al
mov ah,1h ; User input 2
int 21h
sub al,30h; ascii to Hexa
mov ah,0 ;change ah value as 0
div bh
mov dl,al
add dl,30h ; Hexa to ascii
mov bl,ah
mov ah,2h ;print
int 21h
mov dl,bl
add dl,30h ; Hexa to ascii
mov ah,2h ;print
int 21h
mov ah,4ch ;terminate code
int 21h
end start
Comments
Post a Comment