I am trying to make a procedure that returns the sum of only odd numbers entered by the user and everything else is working fine except that the sum value always shows the last integer entered, if i sum all the numbers entered including even numbers then the output is correct so i am assuming maybe the condition is not right?
I tried different methods but i can't seem to figure out exactly where i got it wrong
This is my code, can someone please point out what's the problem here?
ArraySum proc USES esi ecx
mov eax, 0
L1:
test eax, 1
jz L2
add eax, [esi]
add esi, 4
loop L1
L2:
add esi,4
loop L1
ret
ArraySum endp