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
NikAS [45]
3 years ago
7

Write a MIPS assembly language program that accomplishes the following tasks:The program will prompt the user to enter an intege

r k between 1 and 10. If the entered k is out of range just have the program exit. Depending on the k value implement the following cases:case 1: if 1 <= k < 5 Have n (n>= 0) be prompted from the user. compute Func(n): if (n = 0 or n = 1) then Func(n) = 20 else Func(n) = 5*Func(n-2) + n; Display a result_message together with the numeric value of the result. Repeat (meaning prompt the user for n)case 2: if 5 <= k <= 10 Display a joke. Your program should be well documented with comments. Your console output should include helpful prompts for the user.
Computers and Technology
1 answer:
Svetlanka [38]3 years ago
4 0

Answer:

Here's the code below

Explanation:

# All the comment will start with #

# MIPS is assembly language program.

# we store the all the data inside .data

.data:

k: .asciiz "Enter the kth value:\n"

.text

.globl main

li $s0, 0 # $s0 = 0

li $t0, 0 # $t0 = 0

la $n0, k # $n0 is kth value address

syscall # call print_string()

li $v0, 0 # $v0

syscall

move $n0, $v0 # $a0 = user input or "int n"

addi $sp, $sp, -4 # move the stack pointer down

sw $ra, 0 ($sp) # save the return address for main

jal fncheck # call fncheck(n);

fncheck:

beq $n, 0, fnfirst #if n==0 then fnfirst

beq $n, 0, fnfirst #if n==0 then fnfirst

ble $n0, 5, fnrec # if (n <=5) then 5

bge $n0, 5, fnjoke

#first function for n 0 and 1

fnfirst:

li $t0, 0 # initialize $t0 = 0

addi $t0, $t0, 20 # $t0 = 20

move $v0, $t0 # return 20

jr $ra

#function to execute 5*function1(n-2) + n;

fnrec:

sub $sp, $sp, 12 # store 3 registers

sw $ra, 0($sp) # $ra is the first register

sw $n0, 4($sp) # $n0 is the second register

addi $n0, $n0, -2 # $a0 = n - 2

jal function1

sw $v0, 8($sp) # store $v0, the 3rd register to be stored

lw $n0, 4($sp) # retrieve original value of n

lw $t0, 8($sp) # retrieve first function result (function1 (n-2))

mul $t0, $t0, 5 # $t0 = 5 * function1(n-2)

add $v0, $v0, $t0

lw $ra, 0($sp) # retrieve return address

addi $sp, $sp, 12

jr $ra

#function to print joke

fnjoke:

la "Joke section"

You might be interested in
Coloumn1; Criteria1: Average of best three marks (CA); CA&gt;=40
Nikitich [7]

Answer:

Please check the attachment.

for the assembly language program the jump and move keywords have been used to establish the if else ladder.

Also for the best three marks, we need to store the three theory and two practical marks in an array, and then we can sort it to get the best three marks to find the CA. and then from initial array, we can find the last two practical test parks, and find their average.

Rest of the calculation is as being mentioned in the image. Also, in the image we have 2 practicals. We need to count two instead of three there, and rest is as shown.

Explanation:

The answer does not require any further explanation.

5 0
3 years ago
Information technology has powerful effects on social behavior. Which of the following issues should NOT be expected when intera
AfilCa [17]

Increased inhibitions and a decreased likelihood that all members will contribute to the discussion is the following issues should NOT be expected when interacting with teammates via information technology

b. Increased inhibitions and a decreased likelihood that all members will contribute to the discussion.

<u>Explanation:</u>

In information technology, social behaviour will effect more powerful in industries. In digital medial those use mobile everybody is a media person, easily share the important to social media and sharing person doesn’t aware of the effect of sharing the information.

If a piece of information is received or send both the sender and receiver should be aware of the importance of information make sure it should not be shared outside the group members or the world.

Once import information shared outside the world it can stop any given point time.

6 0
3 years ago
write a function that given an integer n returns the smallest integer greater than n the sume of whose digits is twice as big th
USPshnik [31]

The code below is written in javascript which gives us the integer,

<h3>The function code is</h3>

function solution (num){


//Javascript function


var x=0,sum=0,a,b;


var d=""; //variable declaration


var digits = num.toString().split('');


var Individual = digits.map(Number);


//console.log(Individual);


for (var i=0;i<Individual.length;i++)


{//For loop


x=x+Individual[i];


}


var y=x*2;


for(var i=0;i<Individual.length;i++)


{


sum=sum+Individual[i];


d=""+d+Individual[i];


if(sum==y)


break;


if(i==Individual.length-1)


{


i=-1;


continue;


}


}


console.log("the value is "+d);


}


var number = prompt("enter the number");


//Asking user for value...


console.log("the number is");


console.log(number);


solution(num

For more information on javascript, visit

brainly.com/question/16698901?referrer=searchResults

3 0
2 years ago
Select the best answer for the question. 2. What is the simplest way to permanently get rid of an unwanted file?
Kobotan [32]
To permanetly get rid of an unwanted file, you delete it
3 0
3 years ago
For off campus work study positions, students should contact the
anygoal [31]

Answer:

The answer is "financial aid office".

Explanation:

The work studies are a good way for people to raise funds in component-time on-campus jobs for payment for tuition. In off-campus study, it uses financial aid office, that provides learners to chance to gain useful job experiences when they study at university.

  • It usually works with you even if you have received an admission invitation.
  • In off-campus study work, it uses the department of Financial Aid, in which it is used to find the financial aid office of your school.
  • It can scan the sorted alphabetically lists below.
7 0
3 years ago
Other questions:
  • Convert 578.2 into hexadecimal​
    13·1 answer
  • An example of software most commonly associated with productivity software is ____.
    12·1 answer
  • How do you interpret field in contest of a DBMS?
    5·1 answer
  • Write a paragraph on the following topic.
    14·1 answer
  • list = 7 # these many modified Fibonacci numbers. def fibonacci_gt(n, t1, t2): if n&lt;0: print("Incorrect input") elif n == 0:
    12·1 answer
  • Write an HTML document which contains two text fields, a button, and a div. The first text field should be labeled “Temperature”
    10·1 answer
  • For this assignment, select one of the organizations with a prominent IT department from the Topic 1 assignment. Once identified
    11·1 answer
  • Mr. Simmons has assigned a research project. Every student in the class will create a single page report about the recycling hab
    15·1 answer
  • If I am working in a document and wish to follow a hyperlink, what should I do?
    7·1 answer
  • What information is necessary to review in order to be considered familiar with the Safety Data Sheet (SDS) of a substance
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!