write a program that takes twoinput values from the user and calculate the subtraction if the first number is greater than the second one other wise calculate the summation in MIPS
.data
message1:.asciiz"enter number 1"
message2:.asciiz"enter number 2"
message3:.asciiz"the sum is: "
message4:.asciiz"the difference is:"
.text
main:
#enter the input by the user
li $v0,4
la $a0,message1
syscall
#read the user input
li,$v0,5
syscall
#store the enteres value in the register
move $t0,$v0
#enter the input by the user
li $v0,4
la $a0,message2
syscall
#read the user input
li,$v0,5
syscall
#store the enteres value in the register
move $t1,$v0
#compare the values stored in the register
bgt $t0,$t1,difference
add $t3,$t0,$t1
li $v0,0
la $a0,message3
syscall
move $a0,$t3
difference:
sub $t3,$t0,$t1
li $v0,0
la $a0,message4
syscall
move $a0,$t3
Get Answers For Free
Most questions answered within 1 hours.