Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a MIPS program that prompts the user to enter two numbers and performs add

ID: 3874227 • Letter: W

Question

Write a MIPS program that prompts the user to enter two numbers and performs addition, subtraction, multiplication, and division on two numbers and output the results. Please write in assembly language and provide comments. Write a MIPS program that prompts the user to enter two numbers and performs addition, subtraction, multiplication, and division on two numbers and output the results. Please write in assembly language and provide comments. Write a MIPS program that prompts the user to enter two numbers and performs addition, subtraction, multiplication, and division on two numbers and output the results. Please write in assembly language and provide comments.

Explanation / Answer

#addition

# add2.asm

# Registers used:

# $a - used to hold the first number.

# $b - used to hold the second number.

# $c - used to hold the sum of the $a and $b

#.# Get first number from user, put into $a.

## Get second number from user, put into $b.

add $c, $a, $b # compute the sum.

## Print out $c.

li $v0, 10 # syscall code 10 is for exit.

syscall # make the syscall.

# end of add2.asm.

#multiply

# mul2.asm

# Registers used:

# $a - used to hold the first number.

# $b - used to hold the second number.

# $c - used to hold the multiplication of the $a and $b

#.# Get first number from user, put into $a.

## Get second number from user, put into $b.

mul $c, $a, $b # compute the multiplication.

## Print out $c.

li $v0, 10 # syscall code 10 is for exit.

syscall # make the syscall.

# end of mul2.asm.

#divide

# div2.asm

# Registers used:

# $a - used to hold the first number.

# $b - used to hold the second number.

# $c - used to hold the div of the $a and $b

#.# Get first number from user, put into $a.

## Get second number from user, put into $b.

div $c, $a, $b # compute the sum.

## Print out $c.

li $v0, 10 # syscall code 10 is for exit.

syscall # make the syscall.

# end of div2.asm.

#subraction

# add2.asm

# Registers used:

# $a - used to hold the first number.

# $b - used to hold the second number.

# $c - used to hold the sub of the $a and $b

#.# Get first number from user, put into $a.

## Get second number from user, put into $b.

sub $c, $a, $b # compute the sub.

## Print out $c.

li $v0, 10 # syscall code 10 is for exit.

syscall # make the syscall.

# end of sub2.asm.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote