Question: Coding help. Below is my current code. . data prompt 1 : . asciiz Please enter the first integer: prompt 2 : . asciiz
Coding help.
Below is my current code.
data
prompt: asciiz "Please enter the first integer:
prompt: asciiz "Please enter the second integer:
prompt: asciiz "Please enter a math function among or :
outputgt: asciiz "The first integer is greater than the second."
outputlt: asciiz "The first integer is less than the second."
outputeq: asciiz "The two integers are equal."
text
main:
# Enter st integer
li $v
la $a prompt
syscall
# Save the entered integer in $s
li $v
syscall
move $s $v
# Enter nd integer
li $v
la $a prompt
syscall
# Save the entered integer in $s
li $v
syscall
move $s $v
# Compare the two integers
slt $t $s $s
bne $t $zero, lessthan
beq $s $s equal
j greaterthan
lessthan:
# Output the less than result
li $v
la $a outputlt
syscall
j exit
equal:
# Output the equal result
li $v
la $a outputeq
syscall
j exit
greaterthan:
# Output the greater than result
li $v
la $a outputgt
syscall
exit:
# Exit the program
li $v
syscall
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
