Header Ads

read two capital letters and display them on the next line In alphabetical order

#. Write a program to display a "?", read two capital letters, and display them on the next line In alphabetical order. 


Solution:

.model small
.stack 100h
.data

msg db 10,13,'?$'
msg1 db 10,13,'Enter two capital letter: $' 
msg2 db 10,13,'Output is: $'

.code

     mov ax,@data     
     mov ds,ax
               
     lea dx,msg           
     mov ah,9     
     int 21h
                
     lea dx,msg1     
     mov ah,9     
     int 21h
               
     mov ah,1     
     int 21h     
     mov bl,al
    
     mov ah,1     
     int 21h    
     mov cl,al
    
     lea dx,msg2    
     mov ah,9    
     int 21h 
    
    
     cmp bl,cl       
     ja Next 
    
    
    mov dl,bl    
    mov ah,2    
    int 21h         
    mov dl,cl    
    int 21h          
    jmp Exit: 
   
   
    Next:             
    
    
    
     mov dl,cl    
     mov ah,2    
     int 21h         
     mov dl,bl    
     int 21h           
     jmp Exit:       
    
    
      Exit:
     
      mov ah,4ch
      int 21h

Output:

 alphabetical order
 alphabetical order output



No comments

Powered by Blogger.