Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MIPS assembly code The read int system call (number 5) will cause the running program to stop and wait for the user to type in

MIPS assembly code

image text in transcribed

The read int system call (number 5) will cause the running program to stop and wait for the user to type in an integer at the keyboard. The integer will be put into $v0 register and will be available after the syscall completes. write a MIPS assembly language program which prompts for a user to enter four integers and calls read_int four times to read in four integers. The program should perform addition, subtraction, multiplication, integer division, and modulo operation (compute the remainder of their division) using two of these four integers (see the C program below), then display their result on the console window. Also compute num2 - (((num4 + num1 mod 3) * 2)um3) is the first read integer, num2 is the second read integer, num3 is the third read integer, and num4 is the forth read integer, and display the result. Name your source code file assignment3.s. The following shows how it looks like in a C program: int num1, num2, num3, num4, ans1, ans2, ans3, ans4, ans5, ans6: printf ("Enter a value: "): //read an integer from a user input and store it in num1 scanf("%d", &num1): printf ("Enter another value: ") //read an integer from a user input and store it in num2 scanf("%d", &num2): printf ("Enter one more value: "): //read an integer from a user input and store it in num3 scanf("%d", &num3) printf ("Enter one more value: ") //read an integer from a user input and store it in num4 scanf ("%d", &num4): ans1 = num2+num3: //addition print f("num2 +num3=%d ", ans 1): ans2 = num3+num4: //subtraction printf("num3-num4=%d ", ans2): ans3 = num3*num1: //multiplication printf("num3*num1=%d ", ans3): ans4 = num2+num4: //integer division printf("num2um4=%d ", ans4): ans5 = num4+num3: //remainder of division printf("num4 mod num3=%d ", ans5): ans6 = num2-({{num4 + num 1 % 3}*2} num3): printf("num2-({{num4 + num 1 % 3}*2} num3)=%d ", ans6): Here is a sample output(user input is in bold)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions

Question

why would a country typically desire a stronger currency

Answered: 1 week ago

Question

Question What is a secular trust?

Answered: 1 week ago