Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a MIPS program to solve the following problem: a. Prompt the user to enter 3 integer values. b. Read the integer. c. Calculate and

Write a MIPS program to solve the following problem: a. Prompt the user to enter 3 integer values. b. Read the integer. c. Calculate and print the average of the integers as an integer result. d. Calculate and print the average of the integers as a floating point number. The number of decimal places is not relevant in your answer

***no Pseudo-instructions allowed***

This is what I have so far:

.data data:.word 0,0,0 prompt: .asciiz "Enter 3 integers " newline: .asciiz " "

.text ori $v0,$0,4 # Command to print string lui $a0,0x1001 # Sets register for data addiu $a0,$a0,12 # Get start of prompt syscall # Print the prompt ori $v0,$0,5 # Command to read integer syscall # Value in $v0 lui $t0,0x1001 # Sets register $t0 sw $v0, 0($t0) # Stores value of first integer ori $v0,$0,5 # Command to read integer syscall # Value in $v0 lui $t1,0x1001 sw $v0, 4($t1) # Stores value of second integer ori $v0,$0,5 # Command to read integer syscall # Value in $v0 lui $t2,0x1001 sw $v0, 8($t2) # Stores value of second integer add $t0,$t0,$t1 add $t0,$t0,$t2 # Sums three integers

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

More Books

Students also viewed these Databases questions

Question

What is the purpose of brand management?

Answered: 1 week ago

Question

1. The evaluation results can be used to change the program.

Answered: 1 week ago

Question

5. To determine the financial benefits and costs of the program.

Answered: 1 week ago