Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a mips program that read in 20 integers stores them in an array then calls the following funtion then print the appropriate result: minmax:

write a mips program that read in 20 integers stores them in an array then calls the following funtion then print the appropriate result:

minmax: find the smallest and the largest number in the array

divisible: show how many numbers in the array are divisible by 4

so far i have done reading the 20 integers and store them in an array, how do i do the 2 functions?

.data array: .space 80 prompt: .asciiz "Enter an integer for the array: " snumber: .asciiz "The smallest number is: " lnumber: .asciiz "The largest number is: " divide4: .asciiz "Number of integers divisible by 4: "

.globl main .text

main: li $t0 20 #initialize 20 spaces la $a1 array #load array li $t1 0 #index i = 0

loop1: la $a0 prompt #ask to enter integers li $v0, 4 #print prompt syscall

li $v0, 5 #read integers from console syscall sw $v0, 0 ($a1) #store it addi $a1 $a1 4 #increments the array addi $t1 $t1 1 #increments the index bne $t1 $t0 loop1 #check if condition is true

la $a1 array #reload the arrray li $t1 0 #counter start from 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

3. Did you seek anyones advice?

Answered: 1 week ago

Question

1. What is meant by Latitudes? 2. What is cartography ?

Answered: 1 week ago

Question

What is order of reaction? Explain with example?

Answered: 1 week ago

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago