1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
konstantin123 [22]
3 years ago
11

Write a program that echos back any inputted integer greater than 1, and exits when a 0 is entered. Your program should use a co

nditional branch when deciding whether to echo back the integer or exit the program. It should use a jump when looping back up to run the input+echo again.
Computers and Technology
1 answer:
denpristay [2]3 years ago
7 0

Answer:

MIPS Code:

.data

newline: .asciiz "\n" #newline variable

.text

MAINLOOP:

li $v0, 5 #syscall to get user interger and store in $v0

syscall

add $a0, $zero, $v0 #moving the user input to $a0 from $v0

beq $a0, 0, EXIT #branching to EXIT when $a0 is 0

li $v0, 1 #syscall to print integer in $a0

syscall

li $v0, 4 #syscall to print newline

la $a0, newline

syscall

j MAINLOOP #jumping to MAINLOOP

EXIT:

Sample Output:

6

6

7

7

3

3

0

You might be interested in
Write the following function without using the C++ string class or any functions in the standard library, including strlen(). Yo
dolphi86 [110]

Answer:

The function in C++ is as follows

int chkInd(string str1, string str2){    

int lenstr1=0;

while(str1[lenstr1] != '\0'){  lenstr1++;  }

int index = 0; int retIndex=0;

for(int i=lenstr1-1;i>=0; i--){

   while (str2[index] != '\0'){

       if (str1[i] == str2[index]){

           retIndex=1;

           break;         }

       else{   retIndex=0;      }

  index++;    }

  if (retIndex == 0){   return i;   }else{return -1;}}

}

Explanation:

This defines the function

int chkInd(string str1, string str2){    

First, the length of str1 is initialized to 0

int lenstr1=0;

The following loop then calculates the length of str1

while(str1[lenstr1] != '\0'){  lenstr1++;  }

This initializes the current index and the returned index to 0

int index = 0; int retIndex=0;

This iterates through str1

for(int i=lenstr1-1;i>=0; i--){

This loop is repeated while there are characters in str2

   while (str2[index] != '\0'){

If current element of str2 and str1 are the same

       if (str1[i] == str2[index]){

Set the returned index to 1

           retIndex=1;

Then exit the loop

           break;         }

If otherwise, set the returned index to 0

       else{   retIndex=0;      }

Increase index by 1

  index++;    }

This returns the calculated returned index; if no matching is found, it returns -1

  if (retIndex == 0){   return i;   }else{return -1;}}

}

4 0
3 years ago
Chelsea wants to know about the requirements for being a lab technician. Where could she find that information?
7nadin3 [17]
On a job application.
5 0
2 years ago
"You have an interface on a router with the IP address of 192.168.192.10/29. Including the router interface, how many hosts can
SSSSS [86.1K]

Answer:

6 hosts can have IP addresses on the LAN attached to the router interface

Explanation:

Given IP address

=> 192.168.192.10/29

It has a subnet mask of /29 which means it has 3 host bits. This is calculated by subtracting 29 from 32(number of bits in an IPV4)

Since there are 3 host bits,  the total number of possible addresses is given by

=> 2^{3} = 8 possible addresses.

Out of these 8 possible addresses, the first address will be the subnet id and the last address will be the broadcast address.

Therefore, there are only 6 addresses available for the hosts.

<em>Hope this helps!</em>

5 0
3 years ago
Describe how to create a new folder on the desktop​
Ne4ueva [31]

Justt create a new folder!

3 0
3 years ago
Read 2 more answers
Jennifer, a customer, informs you that unexpected icons are appearing on her system's desktop. You identify the symptoms of the
Maslowich

Answer:

B. Schedule scans and run updates.

Explanation:

With a malware infection you have to scan the computer with an antivirus immediately. Then, you run possible updates to get the system stronger.

8 0
3 years ago
Other questions:
  • What privacy issues have arisen with webcams in mobile devices?
    8·1 answer
  • Which of the following statements is true?
    11·1 answer
  • Keeping in mind the role the order of precedence plays in equations, what would Excel display as the result of the following equ
    15·1 answer
  • What is the name of the symbol that is used to classify and categorize information?​
    10·2 answers
  • Does two core processors mean that it is twice as fast do you agree? why?
    13·1 answer
  • Select the guidelines you should follow when creating a resume
    12·2 answers
  • Write a definition in your own words for telecommunication. Do not cop and paste please.
    15·1 answer
  • I know I'm asking for a lot. But this is my last question. If we do it I pass my semester. help please.
    15·1 answer
  • Which of the following is not harmful to the computer?<br> a) Trojan<br> b) Rootkit<br> c)Malware
    15·1 answer
  • Information Technology (IT) is a component of an Information System (IS)<br><br> True or False
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!