Question: Write a MIPS code for your program . In the program you prompt the user to enter two numbers and performs multiplication, and division on

Write a MIPS code for your program . In the program you prompt the user to enter
two numbers and performs multiplication, and division on two numbers and output the results
================================================================================
===============================================================================
Sample output could look like:
=============================================================================
Please input the two numbers?
23
12
Product is: 276
Quotient is: 1
Remainder is: 11
Do not use mul, must use mult, also do not use move
Sample code for mult
.data
space: .asciiz "
"
.text
main:
li $s1,20
li $s2,30
mult $s1, $s2 #multiply $s1 by $s2 and place the results
#into lo and hi
mfhi $t0 #move the value of hi register into $t0
mflo $t1 #move the value of lo register into $t1
li $v0,1
add $a0, $t1, $0
syscall
li $v0,10
syscall
Sample code for div
main:
li $s1,10
li $s2,2
div $s1, $s2 #divide $s1 by $s2 and place the quotient
#into lo and remainder in hi registers
mfhi $t0 #move the value of hi register into $t0
mflo $t1 #move the value of lo register into $t1
li $v0,1
add $a0, $t1, $0
syscall
li $v0,4
la $a0, space
syscall
li $v0,1
add $a0, $t0, $0
syscall

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!