subject

I am having trouble of getting the coding working because I have four errors and I have hard getting the sum and odd even working I have got the odd number sun working. But now it won’t bring out my even number sum and keeps asking for a number.
My loop asks for the number, I then mov eax to the ebx and clear for division. If it is even I jump it out of loop and do addition for the even sum in that exit loop. I loop back to L1 from there and have it finish adding the odd numbers which will come out properly. After that it just endlessly asks me to enter a number.
instruction:
Lab 7A - Summing Numbers
Ask the user for the amount of numbers they would like to input. Construct a counted loop that will run the number of times the user specified. Inside the loop input numbers from the keyboard and sum all of the odd and even numbers. Use two DWORD variables to hold the odd and even sums. Create a DWORD variable called divisor and store 2 in it. This will be used to divide the number input.
Do not use .IF and .ELSE constructs
Your program should look like the following:
How many number do you want to input?
5
Enter a number
1
Enter a number
2
Enter a number
3
Enter a number
4
Enter a number
5
The sum of the even numbers is 6
The sum of the odd numbers is 9
Press any key to close this window . . .
Something to consider:
When you read a number from the keyboard. You need to store it to another register before calling the div instruction. Remember, the div instruction will modify both the eax and the edx register. If you store the value read into the ebx for instance you can simply add it to the even or odd sum depending on the result of the division.
my code
INCLUDE asmlib. inc
.data
sum DWORD 0
evenCount DWORD 0
oddCount DWORD 0
divisor DWORD 2
msg BYTE "How many numbers do you want to input?",0
prompt BYTE "Enter a number ", 0
outpEven BYTE "The sum offset the even numbers is ", 0
outpOdd BYTE "The sum of the odd numbers is",0
.code
main PROC
mov edx, OFFSET msg ;prime the loop
call writeLine ;getting the first
call readInt ;number
mov ecx, eax
mov edx, OFFSET prompt
L1:
call writeLine
call readInt
mov edx, eax ;store eax
mov edx, 0 ;clear for the division
div divisor ;divide by 2
cmp edx, 0
jne EVEN
inc evenCount
add sum, eax
mov edx, OFFSET prompt
call writeString
call writeInt
LOOP L1
EVEN:
inc evenCount,0
jle ODD
mov eax, sum
mov edx, OFFSET outpEven
call writeString
call writeInt
endl
LOOP L1
jmp EXIOUT
ODD:
mov edx, OFFSET outpOdd
call writeLine
EXIOUT:
exit
main ENDP
END main

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:30
Awell-diversified portfolio needs about 20-25 stocks from different categories is this true or false?
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
[java] create an application called registrar that has the following classes: a. a student class that minimally stores the following data fields for a student: - name - student id number - number of credits - total grade points earned and this class should also be provides the following methods: - a constructor that initializes the name and id fields - a method that returns the student name field - a method that returns the student id field - methods to set and retrieve the total number of credits - methods to set and retrieve the total number of grade points earned. - a method that returns the gpa (grade points divided by credits) b. an instructor class that minimally stores the following data fields for an instructor: - name - faculty id number - department the following methods should be provided: - a constructor that initializes the name and id fields - methods to set and retrieve the instructor’s department. c. a course class that minimally stores the following data for a course: - name of the course- course registration code- maximum number of 35 students- instructor- number of students- students registered in the course (an array)the following methods should also be provided: - a constructor that initializes the name, registration code, and maximum number of students- methods to set and retrieve the instructor- a method to search for a student in the course; the search should be based on an id number.- a method to add a student to the course. if the course is hill, then an exception with an appropriate message should be raised (try creating your own exception class for this). also, be sure that the student is not already registered in the course. the list of students should be in the order that they registered.- a method to remove a student from the course. if the student is not found, then an exception with an appropriate message should be raised (use the same exception class mentioned a method that will allow course objects to be output to a file using object serialization- a method that will allow course objects to be read in from a file created with object serializationyou will note that the student and instructor classes described above have some commonality. create aperson class that captures this commonality and uses it as a base class for student and instructor. this class should be responsible for the name and id fields and also provide atostring method that returns a string of the form name, id. this will be the inheritedtostring method for the student and instructor classes.1. draw a uml diagram for diss application.2. implement the previous classes in java. write a main program that can serve as a test class that tests all of the methods created and demonstrates that they are working
Answers: 2
question
Computers and Technology, 24.06.2019 23:00
The valves of the heart and veins are similar in that they both
Answers: 1
question
Computers and Technology, 24.06.2019 23:00
Hypertension occurs when blood pressure is too high.
Answers: 1
You know the right answer?
I am having trouble of getting the coding working because I have four errors and I have hard getting...
Questions
question
Mathematics, 04.02.2022 02:30
question
Mathematics, 04.02.2022 02:30
question
Mathematics, 04.02.2022 02:30
question
Mathematics, 04.02.2022 02:30