Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, This is ANNA assembly code. Please do this in ANNA assembly Code and not any other code. You can look it up if you're
Hello, This is ANNA assembly code. Please do this in ANNA assembly Code and not any other code. You can look it up if you're not sure what it is. It is not c,c++ or java.
Write an ANNA assembly program (sec last.ac) that finds the (n/2)-th number entered by the user. Initially, the program continually asks the user to enter numbers. Assume that the user enters "n" non-negative values. As soon as a negative value is entered, compute which number was entered at the (n - 1)-th position. For instance, if the user entered 2, 6, 7, 6, 6, 8, 6, -1; the program should print 8 (the number entered at then-1- 7-1- 6th position in the sequence). Similarly, if the user entered 2, 3, 5, 4, 7, 6, 9, l-1, the program should print 9 (the number entered at the n-1 8-1-7th position in the sequence. Note that the last negative value entered in the sequence is not counted in the value of "n." If the user enters a negative number at the beginning, print -1 Notes: The goal of this problem is to exercise storing, retrieving, and scanning the numbers stored in memory. If your program solves the problem without storing and retrieving the entered values from a memory array, it will not get more than 15 points. You will not be able to keep track of everything in the input loop, as you don't know how many values the user would enter. Therefore, you will need to store all numbers entered by the user in memory. * Store all numbers entered into a growing array. The array should be the last item in your data section so it can grow as large as necessary. Recall, the data section should be at the end of your program, even after the "halt" statement. u may assume there is enough memory to hold all numbers entered by the user. Write an ANNA assembly program (sec last.ac) that finds the (n/2)-th number entered by the user. Initially, the program continually asks the user to enter numbers. Assume that the user enters "n" non-negative values. As soon as a negative value is entered, compute which number was entered at the (n - 1)-th position. For instance, if the user entered 2, 6, 7, 6, 6, 8, 6, -1; the program should print 8 (the number entered at then-1- 7-1- 6th position in the sequence). Similarly, if the user entered 2, 3, 5, 4, 7, 6, 9, l-1, the program should print 9 (the number entered at the n-1 8-1-7th position in the sequence. Note that the last negative value entered in the sequence is not counted in the value of "n." If the user enters a negative number at the beginning, print -1 Notes: The goal of this problem is to exercise storing, retrieving, and scanning the numbers stored in memory. If your program solves the problem without storing and retrieving the entered values from a memory array, it will not get more than 15 points. You will not be able to keep track of everything in the input loop, as you don't know how many values the user would enter. Therefore, you will need to store all numbers entered by the user in memory. * Store all numbers entered into a growing array. The array should be the last item in your data section so it can grow as large as necessary. Recall, the data section should be at the end of your program, even after the "halt" statement. u may assume there is enough memory to hold all numbers entered by the userStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started