Assembly language program to input an integer from user and display whether the number is even or odd
Code
org 100h
.stack 100h
.data
even db "The number is Even$"
odd db "The number is Odd$"
.code
main proc
mov ax,@data
mov ds,ax
mov ah,01
int 21h
mov dx,0
mov bx,2
div bx
mov cx,dx
cmp cx,0
je eve
call line ;caling line procedure
mov dx,offset odd
mov ah,09
int 21h
mov ah,4ch
int 21h
eve:
call line ;caling line procedure
mov dx,offset even
mov ah,09
int 21h
mov ah,4ch
int 21h
main endp
line proc
;this is another procedure for new line
mov dx,10
mov ah,02
int 21h
mov dx,13
mov ah,02
int 21h
ret
line endp
end main
Comments
Post a Comment