My program takes input from users, sort them and print out the result. But I would also like for it to only print out odd numbers and print out even numbers.Any help is appreciated.


arrayInt DWORD 10 dup(0)
sentence BYTE   "Please input a three digit integer: "

main PROC

	mov esi, 0
	mov ecx, LENGTHOF sentence

	mov al, sentence[esi]
	call WriteChar
	inc esi
Loop L1

;Filling array
	mov	ecx , LENGTHOF arrayInt
	mov 	esi, 0

	call 	ReadInt
	mov	arrayInt[esi], eax
	add	esi, 4
Loop	L2

;Sorting array
	mov	edx, 0			; bubble flag
	mov	ecx, LENGTHOF arrayInt
	dec	ecx
	mov	esi, 0			; first elemennt
	mov	eax, arrayInt[esi]
	cmp	eax, arrayInt[esi+4]
	jle	OutLoop

; If first element grater then second switch their places
	mov	ebx, arrayInt[esi+4]
	mov	arrayInt[esi], ebx
	mov	arrayInt[esi+4], eax
	mov	edx, 1			; set bubble flag
	add	esi, 4
Loop	InnerLoop
	cmp	edx, 1
	je	L3

; Printing array
	mov	ecx, LENGTHOF arrayInt
	mov	esi, OFFSET arrayInt
	mov	eax, [esi]
	add	esi, 4
	call 	WriteInt
	call	CrLf
Loop	L4

main ENDP
END main

not done assembly for a while but...

in the array loop if you have a flag for odd / even and XOR it every time the loop goes round it will switch from odd to even. Then test the flag to see whether to print or not (an algorithm I use in c++)