Write a MIPS assembly program that asks a user to input a list of real numbers (represented as single precision floating point numbers) and then prints out the average and variance of those numbers. The program should first ask the user how many numbers they wish to enter and validate that this number is greater than 1. Assuming the user inputs n, then the program should perform n system calls to collect these numbers. Assuming the numbers are given by x1, x2, by: 18 = 1 n n, then the average and variance are given IM³ æk and 1 n var(x) = n - 1 (2kg) k=1 Note how the variance depends on first calculating the average. As an example, if the user specifies 4 numbers and then enters 1.0, 1.5, 2.5, and 3.0, then the average is (1.0 + 1.5 + 2.5 + 3.0) / 4 = 2.0. The variance is ((1.0 - 2.0)2 + (1.5 - 2.0)² + (2.5 - 2.0)² + (3.0 - 2.0)²) / 3 = (1 + 0.25 +0.25 + 1) / 3 = 2.5/3 = 0.83333. Hint: You can use an array to help store the numbers if you would like (although there is a more mathy way to calculate the variance without having to store the numbers).

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
Help please this is the code so far, but I need help finding the average of the numbers inputted by the user
 
 
CODE:

prompt: .asciiz "Enter the number of real numbers: "
.text
.globl main
main:

li $v0, 4
la $a0, prompt
syscall

li $v0, 5
syscall

move $t0, $v0

li $t1, 0

loop:
beq $t0, $t1, end

li $v0, 6
syscall

addi $t1, $t1, 1
j loop

end:
li $v0, 10
syscall

Write a MIPS assembly program that asks a user to input a list of real numbers
(represented as single precision floating point numbers) and then prints out the average and
variance of those numbers. The program should first ask the user how many numbers they wish
to enter and validate that this number is greater than 1. Assuming the user inputs n, then the
program should perform n system calls to collect these numbers.
Assuming the numbers are given by x1, x2,
by:
18
=
1
n
n, then the average and variance are given
IM³
æk
and
1
n
var(x)
=
n
- 1
(2kg)
k=1
Note how the variance depends on first calculating the average.
As an example, if the user specifies 4 numbers and then enters 1.0, 1.5, 2.5, and 3.0, then the
average is (1.0 + 1.5 + 2.5 + 3.0) / 4 = 2.0. The variance is
((1.0 - 2.0)2 + (1.5 - 2.0)² + (2.5 - 2.0)² + (3.0 - 2.0)²) / 3 = (1 + 0.25 +0.25 + 1) / 3 = 2.5/3 =
0.83333.
Hint: You can use an array to help store the numbers if you would like (although there is a more
mathy way to calculate the variance without having to store the numbers).
Transcribed Image Text:Write a MIPS assembly program that asks a user to input a list of real numbers (represented as single precision floating point numbers) and then prints out the average and variance of those numbers. The program should first ask the user how many numbers they wish to enter and validate that this number is greater than 1. Assuming the user inputs n, then the program should perform n system calls to collect these numbers. Assuming the numbers are given by x1, x2, by: 18 = 1 n n, then the average and variance are given IM³ æk and 1 n var(x) = n - 1 (2kg) k=1 Note how the variance depends on first calculating the average. As an example, if the user specifies 4 numbers and then enters 1.0, 1.5, 2.5, and 3.0, then the average is (1.0 + 1.5 + 2.5 + 3.0) / 4 = 2.0. The variance is ((1.0 - 2.0)2 + (1.5 - 2.0)² + (2.5 - 2.0)² + (3.0 - 2.0)²) / 3 = (1 + 0.25 +0.25 + 1) / 3 = 2.5/3 = 0.83333. Hint: You can use an array to help store the numbers if you would like (although there is a more mathy way to calculate the variance without having to store the numbers).
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Similar 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