Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!