input is number or not in assambly language
;to check whether the input is a number
.model small
.stack 100h
.data
msg db "your input is a number$"
mdg db 13,10,"your input is not a number$"
.code
start:
mov ax,@data
mov ds,ax
mov ah,1
int 21h
mov bl,al
cmp bl,58
jg line0
cmp bl,48
jl line0
mov dl,bl
lea dx,msg
mov ah,9h
int 21h
jmp down
line0:
mov dl,0
lea dx,mdg
mov ah,9h
int 21h
int 21h
jmp down
down:
mov ah,4ch
int 21h
end start
.model small
.stack 100h
.data
msg db "your input is a number$"
mdg db 13,10,"your input is not a number$"
.code
start:
mov ax,@data
mov ds,ax
mov ah,1
int 21h
mov bl,al
cmp bl,58
jg line0
cmp bl,48
jl line0
mov dl,bl
lea dx,msg
mov ah,9h
int 21h
jmp down
line0:
mov dl,0
lea dx,mdg
mov ah,9h
int 21h
int 21h
jmp down
down:
mov ah,4ch
int 21h
end start
Comments
Post a Comment