In: Computer Science
WILL UPVOTE ANSWER!
Modify the given code to accept two integers from the user and print one of the following messages
- the 1st number is bigger
- the 2nd number is bigger
- two numbers are equal
######################################
.data
str1 : .asciiz "enter the 1st integer "
str2 : .asciiz "enter the 2nd integer "
str3 : .asciiz "The 1st num is bigger"
str4 : .asciiz "The 2nd num is bigger"
str5 : .asciiz "Two numbers are equal"
.text
main:
li $v0, 4
la $a0, str1
syscall
li $v0,5
# read 1st int
syscall
move $t0, $v0
li $v0,4
la $a0, str2
syscall
li $v0,5
# read 2nd int
syscall
move $t1, $v0
############## DO NOT CHANGE ABOVE THIS LINE ######################
.
.
your code here
Program:
.data
str1 : .asciiz "enter the 1st integer "
str2 : .asciiz "enter the 2nd integer "
str3 : .asciiz "The 1st num is bigger"
str4 : .asciiz "The 2nd num is bigger"
str5 : .asciiz "Two numbers are equal"
.text
main:
li $v0, 4
la $a0, str1
syscall
li $v0,5
# read 1st int
syscall
move $t0, $v0
li $v0,4
la $a0, str2
syscall
li $v0,5
# read 2nd int
syscall
move $t1, $v0
bgt $t0,$t1,a
bgt $t1,$t0,b
li $v0,4
la $a0, str5
syscall
j end
a:li $v0,4
la $a0, str3
syscall
j end
b:li $v0,4
la $a0, str4
syscall
j end
end: li $v0,10
syscall
Output: