Answered step by step
Verified Expert Solution
Link Copied!

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.image text in transcribed

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 user

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications 18th International Conference Dasfaa 2013 Wuhan China April 22 25 2013 Proceedings Part 2 Lncs 7826

Authors: Weiyi Meng ,Ling Feng ,Stephane Bressan ,Werner Winiwarter ,Wei Song

2013th Edition

3642374492, 978-3642374494

More Books

Students also viewed these Databases questions