Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

General Purpose of Your Speech Analyzing Your Audience

Answered: 1 week ago

Question

Ethical Speaking: Taking Responsibility for Your Speech?

Answered: 1 week ago