1. Write MIPS assembly code to sum “n” positive integers. For example, n=5, read 5 numbers...

70.2K

Verified Solution

Question

Electrical Engineering

1. Write MIPS assembly code to sum “n” positive integers. Forexample, n=5, read 5 numbers in memory (“.data” section) and addthem together.

2. Write MIPS assembly code to calculate N-factorial. Read nfrom the memory. (Hint: use “.data” to define the content in amemory location)

Answer & Explanation Solved by verified expert
4.1 Ratings (562 Votes)
Program to find sum of 5 positive integers data array word 232456789 arrend sum asciiz The sum of the numbers is newLine asciiz n Algorithm to sum positive integers sum 0 initial sum 0 for i 0 to 4 sum sum arrayi registers text main li t00 sum 0 la t3array pointer to current element of array la t2arrend load address of array end j test loop lw t40t3 load arrayi addi t3t34 increment array pointer add t0t0t4 update sum test blt t3t2loop more to do if yes loop print message li v04 la a0sumMessage syscall print sum of 5 numbers li v01 addi a0t00 syscall Program to find Factorial N globl main data msgprompt word msgpromptdata msgres1 word msgres1data msgres2 word msgres2data msgpromptdata asciiz Positive integer msgres1data asciiz The value of factorial    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students