In this part, we will be manipulating "numerical" data at the machine level. The following code first prompts the user to enter numerical values one at a time. That is, the user enters a number, then hits enter, and the next the next number, hits enter, and so on. This keeps going until the user enters the number 0. For this and the next question, you can safely assume that the numbers entered are valid numbers (no characters) and each are also within the valid interval of numbers representable as a (singed) 32 bit integer. The code as of now just prints the total sum of this collection of numbers. .data prompt_for_input: .asciiz "Please enter your numbers, pressing enter after each, (0 to terminate):\n" prompt_for_output: .asciiz "Your quantity of interest is equal to: " .text main: # prompting the user with a message for a string input: li $v0, 4 la $a0, prompt_for_input syscall li $s0, 0 LOOP: li $v0, 5 syscall addu $s0, $s0, $v0 bne $v0, $zero, LOOP # prompting the user with a message for the processed output: li $v0, 4 la $a0, prompt_for_output syscall # printing the output addiu $v0, $zero, 1 addu $a0, $zero, $s0 syscall # Finish the programme: li $v0, 10 # syscall code for exit syscall # exit Modify the code, such that it, instead of the total sum, prints the requested value in the option that belong to you Your task: The maximum of the absolute values. For instance, if the numbers entered are [1, -7, -1, -3, 6, -2, 0], then the printed result must be 7.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In this part, we will be manipulating "numerical" data at the machine level.

The following code first prompts the user to enter numerical values one at a time. That is, the user enters a number, then hits enter, and the next the next number, hits enter, and so on. This keeps going until the user enters the number 0. For this and the next question, you can safely assume that the numbers entered are valid numbers (no characters) and each are also within the valid interval of numbers representable as a (singed) 32 bit integer. The code as of now just prints the total sum of this collection of numbers.

.data prompt_for_input: .asciiz "Please enter your numbers, pressing enter after each, (0 to terminate):\n" prompt_for_output: .asciiz "Your quantity of interest is equal to: " .text main: # prompting the user with a message for a string input: li $v0, 4 la $a0, prompt_for_input syscall li $s0, 0 LOOP: li $v0, 5 syscall addu $s0, $s0, $v0 bne $v0, $zero, LOOP # prompting the user with a message for the processed output: li $v0, 4 la $a0, prompt_for_output syscall # printing the output addiu $v0, $zero, 1 addu $a0, $zero, $s0 syscall # Finish the programme: li $v0, 10 # syscall code for exit syscall # exit
Modify the code, such that it, instead of the total sum, prints the requested value in the option that belong to you
Your task:
The maximum of the absolute values. For instance, if the numbers entered are [1, -7, -1, -3, 6, -2, 0], then the printed result must be 7.
 
 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education