This program takes user input as an array and then determines the number of even numbers and prints them. This program is written using 8086 assembly language using emu8086 software.
TITLE PUCHTAA .MODEL SMALL .STACK 100H .DATA MSG1 DB 0AH, 0DH, "THIS PROGRAM ACCEPTS SIZE OF ARRAY AND ELEMENTS THEN PRINTS EVEN NUMBERS$" MSG DB 0AH, 0DH, "ENTER A LENGHT OF ARRAY: $" ARRAY DB 0AH, 0DH, "ENTER ELEMENTS OF ARRAY$" EVEN DB 0AH, 0DH, "TOTAL EVEN NUMBERS ARE $" CONTINUE DB 0AH, 0DH, "CONTINUE? [Y/N] $" NOEVEN DB 0AH, 0DH, "NO EVEN NUMBERS IN ARRAY!!$" .CODE MAIN: MOV AX, @DATA MOV DS, AX LEA DX, MSG1 MOV AH, 09H INT 21H CONT: LEA DX, MSG MOV AH, 09H INT 21H MOV AH, 01H INT 21H SUB AL, 30H MOV CL, AL LEA DX, ARRAY MOV AH, 09H INT 21H MOV CH, 00H AGAIN: MOV DL, ' ' MOV AH, 02H INT 21H MOV AH, 01H INT 21H SUB AL, 30H MOV AH, 00H MOV BL, 02H AAD DIV BL CMP AH, 00H JE INCREASE RETURN: DEC CL CMP CL, 00H JG AGAIN CMP CH, 00H JE NOEVENS LEA DX, EVEN MOV AH, 09H INT 21H JMP NUM NOEVENS: LEA DX, NOEVEN MOV AH, 09H INT 21H JMP QUEST NUM: MOV DL, ' ' MOV AH, 02H INT 21H POP AX MOV DL, AH ADD DL, 30H MOV AH, 02H INT 21H DEC CH CMP CH, 00H JNE NUM QUEST: LEA DX, CONTINUE MOV AH, 09H INT 21H MOV AH, 01H INT 21H OR AL, 20H CMP AL, 'y' JE CONT JMP EXIT INCREASE: MOV AH, AL ADD AH, AL PUSH AX INC CH JMP RETURN EXIT: MOV AH, 4CH INT 21H END MAIN