The Following Program will take a single digit or character from user and if digit it will print odd or even else it will convert Case
.model small
.stack 100h
.data
msg db 10,13,'Enter number=$'
msg1 db 10,13,'Number is even$'
msg2 db 10,13,'Number is odd$'
msg3 db 10,13, 'Case Convertion=$'
.code
mov ax,@data
mov ds,ax
lea dx,msg
mov ah,9
int 21h
mov ah,1
int 21h
mov bl,al
cmp bl,'9'
ja cc
sar bl,1
jc odd
lea dx,msg1
mov ah,9
int 21h
jmp exit
odd:
lea dx,msg2
mov ah,9
int 21h
jmp exit
cc:
lea dx,msg3
mov ah,9
int 21h
cmp bl,'A'
jnle next
next:
cmp bl,'Z'
jnge con
jmp lower
con:
add bl,32d
mov dl,bl
mov ah,2
int 21h
jmp exit
lower:
cmp bl,'a'
jnle ln
ln:
cmp bl,'z'
jnge conl
conl:
sub bl,32d
mov dl,bl
mov ah,2
int 21h
jmp exit
exit:
.model small
.stack 100h
.data
msg db 10,13,'Enter number=$'
msg1 db 10,13,'Number is even$'
msg2 db 10,13,'Number is odd$'
msg3 db 10,13, 'Case Convertion=$'
.code
mov ax,@data
mov ds,ax
lea dx,msg
mov ah,9
int 21h
mov ah,1
int 21h
mov bl,al
cmp bl,'9'
ja cc
sar bl,1
jc odd
lea dx,msg1
mov ah,9
int 21h
jmp exit
odd:
lea dx,msg2
mov ah,9
int 21h
jmp exit
cc:
lea dx,msg3
mov ah,9
int 21h
cmp bl,'A'
jnle next
next:
cmp bl,'Z'
jnge con
jmp lower
con:
add bl,32d
mov dl,bl
mov ah,2
int 21h
jmp exit
lower:
cmp bl,'a'
jnle ln
ln:
cmp bl,'z'
jnge conl
conl:
sub bl,32d
mov dl,bl
mov ah,2
int 21h
jmp exit
exit:
0 comments:
Post a Comment