Question

In: Computer Science

WILL UPVOTE ANSWER! Modify the given code to accept two integers from the user and print...

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

Solutions

Expert Solution

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:


Related Solutions

Write a C++ code using while loop which is getting the two integers from the user,...
Write a C++ code using while loop which is getting the two integers from the user, and output how many numbers are multiples of 5, and how many numbers are multiples of 7 between the two integers (inclusive).
Question 1: 5pts Write a program to receive two integers as user input and then print:...
Question 1: 5pts Write a program to receive two integers as user input and then print: Sum Difference Product Average Maximum of the two Minimum of the two You may use the min and max functions declared in the math class. ********************************************************************************** Question 2: 10pts An online bank wants you to create a program that will show a prospective customer, how the deposit will grow. Your program should read the initial balance and the annual interest rate. Interest rate is...
Question 1: Write a program to receive two integers as user input and then print: Sum...
Question 1: Write a program to receive two integers as user input and then print: Sum Difference Product Average Maximum of the two Minimum of the two You may use the min and max functions declared in the math class. ********************************************************************************** Question 2: An online bank wants you to create a program that will show a prospective customer, how the deposit will grow. Your program should read the initial balance and the annual interest rate. Interest rate is compounded monthly....
modify the code below to create a GUI program that accepts a String from the user...
modify the code below to create a GUI program that accepts a String from the user in a TextField and reports whether or not there are repeated characters in it. Thus your program is a client of the class which you created in question 1 above. N.B. most of the modification needs to occur in the constructor and the actionPerformed() methods. So you should spend time working out exactly what these two methods are doing, so that you can make...
1. Modify a binary search tree implementation code (that AVL tree code depends on) to print...
1. Modify a binary search tree implementation code (that AVL tree code depends on) to print out the data value for each node it encounters in the insert operation. Remember that the module AVL tree code gets part of its functionality from the BST type, since an AVL tree is a binary search tree, but adds some additional functionality. 2. Add code to the main method to meet the following requirements: (a) Create an AVL tree to hold names stored...
Linux Given a passed parameter to a script, request a number from the user and print...
Linux Given a passed parameter to a script, request a number from the user and print the parameter as many times as that number.
Martin wants to create a program that requires the user to input 10 integers then print...
Martin wants to create a program that requires the user to input 10 integers then print the total number of even integers, highest even integer, lowest even integer, total number of odd integers, highest odd integer, and lowest odd integer. If, however, the user inputs zero (0), the program will display “You have not yet entered 10 integers.” Below is the sample output of the program Martin created. Enter the integers: Integer 1: 15 Integer 2: 9 Integer 3: 71...
Problem Definition: Problem: Given an array of integers print all pairs of integers a and b...
Problem Definition: Problem: Given an array of integers print all pairs of integers a and b where a + b is equal to a given number. For example, consider the following array and suppose we want to find all pairs of integers a and b where a + b = 16 A= [ 10, 4, 6, 15, 3, 5, 1, 13] The following are pairs that sum to 16: 13, 3 6, 10 15, 1 Your program should print these...
Given two lists, write python code to print “True” if the two lists have at least...
Given two lists, write python code to print “True” if the two lists have at least one common element. For example, x = [1,2,3], y=[3,4,5], then the program should print “True” since there is a common element 3.
Write a C++ code to print to the user a simple menu of a fast food...
Write a C++ code to print to the user a simple menu of a fast food restaurant. You should allow the user to select his/her preferred burgers and/or drinks and you should display the final bill to the user for payment. The user should be able to select more than one item. You should use the switch statement.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT