Randaferns
asked on
Assembly question: About displaying even nos
I need to enter 10 positive integers and display only the even nos from the 10 nos entered.
I cant use .IF,.WHILE,.REPEAT directives
I cant use .IF,.WHILE,.REPEAT directives
So what is the problem ? Please post your code that doesn't work.
ASKER
I was wondering if anyone could help me..as i just cant do it..i mean taking the integers in is fine..like this is alli could get..am new to assembly
TITLE Even nos (Evennos.asm)
INCLUDE Irvine32.inc
.data
prompt BYTE "Enter 10 positive integers: ",0
buffer BYTE 50 dup(0)
.code
main PROC
; listing the evens nos from the postive integers added.:
; Ask the user to input 10 postive integers:
call Clrscr ; clear screen
mov edx,OFFSET prompt ; "Enter 10 postive integers: "
call WriteString
exit
main ENDP
END main
TITLE Even nos (Evennos.asm)
INCLUDE Irvine32.inc
.data
prompt BYTE "Enter 10 positive integers: ",0
buffer BYTE 50 dup(0)
.code
main PROC
; listing the evens nos from the postive integers added.:
; Ask the user to input 10 postive integers:
call Clrscr ; clear screen
mov edx,OFFSET prompt ; "Enter 10 postive integers: "
call WriteString
exit
main ENDP
END main
It is against E-E policy to do homeworks for students. However, there is no any reason not to help you to find the solution.
So what is the problem ?
You do not understand the algorithm how to check if number is even ?
The simplest way in assembler to 'and' it with 01h and to check if the result is 0 or 1. In case of 1 the number is odd...
So what is the problem ?
You do not understand the algorithm how to check if number is even ?
The simplest way in assembler to 'and' it with 01h and to check if the result is 0 or 1. In case of 1 the number is odd...
ASKER
well..thanks dimitry..
obviously was not expecting the entire thing..just needed help with the algorithm
i have a basic idea that i can use compare to MOD 2 and check..but if u could help me out a bit with the algorithm, it would be really nice..
Thanks.
obviously was not expecting the entire thing..just needed help with the algorithm
i have a basic idea that i can use compare to MOD 2 and check..but if u could help me out a bit with the algorithm, it would be really nice..
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi dimitry
thanks that was really helpful..
I'll use the test instruction and check
thanks that was really helpful..
I'll use the test instruction and check