In Assembly Language Please Write a program called \"NumAverage\" that inputs nu
ID: 3826965 • Letter: I
Question
In Assembly Language Please Write a program called "NumAverage" that inputs numbers (non-zero positive integers) from a user, averages those numbers, and then displays the result.The program should keep asking for new numbers until the user enters "q" (for quit) or any other character. At that time, the program should average all the numbers entered and display the result. You will need a counter to keep track of the how many numbers are entered. Make sure you display adequate instructions on how the program works. Also display an informative output.
Example: Enter a number: 32
Enter a number: 18
Enter a number: 10
Enter a number: q
The average of your numbers is: 20
================================
For ex write in java language
int sum =0 ; int i =0;
while (input != 'q'){
print(" Enter a number :");
input=next.Int();
sum =input + sum;
i++;}
print ("average number" + ( sum /i) );
Explanation / Answer
.MODEL SMALL
.DATA
VAL1 DB ?
NL1 DB 0AH,0DH,'ENTER HOW MANY NO U WANT:','$'
NL2 DB 0AH,0DH,'ENTER NO:','$'
cmp 0AH,Q
jmp
NL3 DB 0AH,0DH,'AVEARGE:','$'
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
LEA DX,NL1
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
SUB AL,30H
MOV CL,AL
MOV BL,AL
MOV AL,00
MOV VAL1,AL
LBL1:
LEA DX,NL2
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
SUB AL,30H
ADD AL,VAL1
MOV VAL1,AL
LOOP LBL1
LBL2:
LEA DX,NL3
MOV AH,09H
INT 21H
MOV AX,00
MOV AL,VAL1
DIV BL
ADD AX,3030H
MOV DX,AX
MOV AH,02H
INT 21H
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN