# Program to print 0 if integer input is even; 1 if input is odd prompt1: prompt 2: prompt 3: label: num: new ln: main: .data .asciiz "This program prints a zero if the input is even" asciiz "and a 1 if the input is odd.n" asciiz "Enter an integer: " .asciiz "Your result is " .word .asciiz "n" .text li la syscall $v0,4 $a0, promptl li la syscall li $v0,4 $a0, prompt2 li la syscall $v0,4 $a0, prompt 3 $v0,5 syscall move $50, $v0 $10,2 $t0,$s0,$t0 li div mfhi $t1 $v0,4 $a0, label li la syscall li $v0,1 move $a0,$t1 syscall $v0,4 $a0, new_ln li la syscall li $v0,10 syscall #output prompt1 for user #output prompt2 for user #output prompt 3 for user #input the integer and save it to $80 #check if input is odd or even by #division by 2; saving rem in $t1 #print the output label #print result-remainder #print newline #exit program Example Modify the MIPS program in Example as following: 1. Take two integer values from user input instead of using given numbers. The

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter5: Looping
Section: Chapter Questions
Problem 8RQ
icon
Related questions
Question
100%

Please help me to solve this problem. Thank you in advance =)

# Program to print 0 if integer input is even; 1 if input is odd
prompt1:
prompt 2:
prompt 3:
label:
num:
new_ln:
main:
.data
.asciiz "This program prints a zero if the input is even"
asciiz "and a 1 if the input is odd.n"
asciiz "Enter an integer: "
.asciiz "Your result is "
.word
.asciiz "n"
.text
li
la
syscall
$v0,4
$a0, promptl
li
la
syscall
li
la
syscall
li
div
mfhi
$v0,4
$a0, prompt2
li
la
li
syscall
move $80, $v0
$v0,4
$a0, prompt 3
li
la
$v0,5
$t0,2
$t0,$s0, $t0
$t1
$v0,4
$a0, label
syscall
li $v0,1
move $a0,$t1
syscall
$v0, 4
$a0, new_ln
syscall
li $v0, 10
syscall
#output prompt1 for user
#output prompt2 for user
#output prompt 3 for user
#input the integer and save it to $80
#check if input is odd or even by
#division by 2; saving rem in $t1
#print the output label
#print result-remainder
#print newline
#exit program
Example
Modify the MIPS program in Example as following:
1. Take two integer values from user input instead of using given numbers. The
program should prompt "Enter the dividend:" and "Enter the devisor:" to get the
user inputs.
2. Perform the two different division : div and divu and print the quotient and
remainder for each of the division. The program should print "Quotient of div is:",
"Remainder of div is:", "Quotient of divu is:", and "Remainder of divu is:" before it
prints each of the result of the calculations.
3. Do not use [newline: .asciiz "\n"] which is used to print the new line but use
system call 11 instead.
4. Repeat the program until you enter O for dividend and program should end if user
type in integer 0.
5. You need give detail comments to explain what is happening in the code. The
level of detail will be graded.
6. You need to use the newline properly so that the output prints neatly.
You need to show the result screens for at least 4 pairs of numbers (at least 1 pair of
positive numbers, 1 pair of negative dividend & positive divisor, 1 pair of positive
dividend & negative divisor, and 1 pair of both negative numbers) you entered as well as
the screenshot of program termination by entering integer 0.
Transcribed Image Text:# Program to print 0 if integer input is even; 1 if input is odd prompt1: prompt 2: prompt 3: label: num: new_ln: main: .data .asciiz "This program prints a zero if the input is even" asciiz "and a 1 if the input is odd.n" asciiz "Enter an integer: " .asciiz "Your result is " .word .asciiz "n" .text li la syscall $v0,4 $a0, promptl li la syscall li la syscall li div mfhi $v0,4 $a0, prompt2 li la li syscall move $80, $v0 $v0,4 $a0, prompt 3 li la $v0,5 $t0,2 $t0,$s0, $t0 $t1 $v0,4 $a0, label syscall li $v0,1 move $a0,$t1 syscall $v0, 4 $a0, new_ln syscall li $v0, 10 syscall #output prompt1 for user #output prompt2 for user #output prompt 3 for user #input the integer and save it to $80 #check if input is odd or even by #division by 2; saving rem in $t1 #print the output label #print result-remainder #print newline #exit program Example Modify the MIPS program in Example as following: 1. Take two integer values from user input instead of using given numbers. The program should prompt "Enter the dividend:" and "Enter the devisor:" to get the user inputs. 2. Perform the two different division : div and divu and print the quotient and remainder for each of the division. The program should print "Quotient of div is:", "Remainder of div is:", "Quotient of divu is:", and "Remainder of divu is:" before it prints each of the result of the calculations. 3. Do not use [newline: .asciiz "\n"] which is used to print the new line but use system call 11 instead. 4. Repeat the program until you enter O for dividend and program should end if user type in integer 0. 5. You need give detail comments to explain what is happening in the code. The level of detail will be graded. 6. You need to use the newline properly so that the output prints neatly. You need to show the result screens for at least 4 pairs of numbers (at least 1 pair of positive numbers, 1 pair of negative dividend & positive divisor, 1 pair of positive dividend & negative divisor, and 1 pair of both negative numbers) you entered as well as the screenshot of program termination by entering integer 0.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Concept of memory addresses in pointers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage