Write a MIPS assembly language program that accomplishes the following tasks:The program will prompt the user to enter an integer 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.

Answers

Answer 1
Answer:

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


Related Questions

MIDDLE SCHOOL

Why is drafting important in every industry

Answers

The Writing Process- Drafting and Editing. Writing is a process that involves several distinct steps: prewriting, drafting, revising, editing, and publishing. It is important for a writer to work through each of the steps in order to ensure that he has produced a polished, complete piece.

HIGH SCHOOL

Which partitioning method must be used for partitioning a 4-tb hard drive?

Answers

For partitioning a 4-tb hard drive the partitioning method GPT must be used.GPT partitioning method stands for GUID Partition Table. A GPT disk can support larger than 2 TB volumes and up to 128 partitions. Due to replication and cyclical redundancy check (CRC) protection of the partition tableprovides greater reliability.
COLLEGE

Write the sql command to show which tutor needs to be reminded to turn in reports.

Answers

SELECT TO_CHAR (Tutor Report.Month, 'MONTH') MONTH, Tutor Report.MatchID, Match History.MatchID, MatchHistory.Tutor.ID FROM Tutor Report, MatchID WHERE Tutor Report.MatchID=Match History.MatchID AND NOT (TutorReport.Month=‘JULY’);
MIDDLE SCHOOL

A carpenter sands a wooden board until it is smooth. Is this a physical or a chemical change?

Answers

When a carpenter sands a wooden board until it is smooth this is a physical  change, because the chemical properties of the wood are not changed, only its appearance. It is still wood just a bit more smooth. This means that this change doesn't change what the substance (the wood)  is. A chemical change on the other hand is change in which a new substance is formed and energy is either given off or absorbed.


This is a physical change. Because he is not changing what it is just its outward appearance. hope this helped.
HIGH SCHOOL

Amy is not sure if the Web page loaded completely in her browser. She should look at the _____. search engine command toolbar address bar status bar

Answers

She should look at her address bar 

she would have to look at the address bar

MIDDLE SCHOOL

Before using large downloaded files that are in a compressed format, it is necessary to_____ them. A) Copy B) Extract C) Open D) Zip

Answers

The answer is zip. God bless

MIDDLE SCHOOL

You can enter text on a slide by using: placeholders textboxes flow charts

Answers

You can enter text on a slide by using "textboxes".
I would recommend the text boxes. In my digital literacy class(computer class) we use Microsoft computers so we have Microsoft word. We use Microsoft word alot and when we make slides we use textboxes. I also use text boxes on word at my house on my Apple Mac computer.
HIGH SCHOOL

What is a credit card reader usually paired up with in order to take a credit card transaction? App
Barcode reader
NFC device
Website

Answers

Answer:

NFC device is used to pair credit card with to make a credit card transaction.

Explanation:

NFC means Near field communication. This device is used with credit card or debit card for secure transaction of money while purchasing something. It is an electronic device integrated with antenna that enables the seller to make transaction through debit or credit securely.

HIGH SCHOOL

The ____ search feature allows you to look for words with extensions such as “ing,”“ed,” and so forth. .

Answers

The STEMMING search feature allows you to look for words with extensions such as "ing," "ed," and so forth.
Random Questions