Even or Odd
Even or Odd
MINI PROJECT PROBLEM STATEMENT :- PRINT IF THE NUMBER IS EVEN OR ODD FROM 1-25.
---------------------------------------------------------------------------------------------------------------------------------------------------------
CODE:
section .data
even_msg db ' is an Even Number!',13,10
len1 equ $ - even_msg
odd_msg db ' is an Odd Number!',13,10
len2 equ $ - odd_msg
cur db 0
section .bss
num resb 5 ;Reserved 5 Bytes for Input
section .text
_start:
xor ch,ch
xor cx,cx
inc cx
loop1:
push cx
mov ax,cx
MOV AH,0
mov bl,0x0A
div bl
mov cx,ax
mov cl,ch
mov ch,0
push cx
mov ah,0
mov bl,0x0A
div bl
mov cx,ax
mov cl,ch
mov ch,0
push cx
pop cx
add cx, '0'
mov [cur], cx ;
write cur,len2 ;printing the number
pop cx
add cx, '0'
mov [cur], cx ;
write cur,len2
pop cx
push cx
mov ax,cx
inc cx
and ax, 1
jz evnn
jmp loop1
pop cx
inc cx
jmp loop1
;Exit
outprog:
mov eax, 1 ;system call number (sys_exit)
int 0x80 ;call kernel
----------------------------------------------------------------------------------------------------------------------------------------------
OUTPUT: