Question: MIPS assebly I have coded 90% of the program, please code to print average only so that output looks like the one below Please as

MIPS assebly

I have coded 90% of the program, please code to print average only so that output looks like the one below

Please as fast as you can

MIPS assebly I have coded 90% of the program, please code toThat is my code so far:

.data MSG1: .asciiz "Please enter number of values to be entered: " MSG2: .asciiz "Invalid entry" MSG3: .asciiz "" MSG4: .asciiz "," MSG5: .asciiz "Values of even numbers are:" MSG6: .asciiz "Average of even numbers are:" .text .globl main main: addiu $sp,$sp,-40 li $v0,4 la $a0,MSG1 syscall li $v0,5 syscall move $t0,$v0 #numValues slti $t5,$t0,1 bne $t5,$zero,L1 li $t6,11 slt $t5,$t6,$t0 bne $t5, $zero,L1

li $t4,0 #cnt li $t3,0 #sum li $t1,0 #i move $t8,$sp #$t8 is initialized to add of local #vector even[0] LOOP: slt $t5,$t1,$t0 beq $t5,$zero,L2 li $v0,5 syscall move $t2,$v0 #val

li $t6,2 div $t2,$t6 mfhi $t6 bne $t6,$zero,SKIP addu $t3,$t3,$t2 sw $t2,($t8) addiu $t4,$t4,1 addiu $t8,$t8,4 SKIP: addiu $t1,$t1,1 j LOOP L2: slti $t5,$t4,1 bne $t5,$zero,OUT li $v0,4 la $a0,MSG5 syscall

move $t8,$sp lw $t5,($t8) move $a0,$t5 li $v0,1 syscall

li $t1,1 #i addiu $t8,$t8,4 LOOP2: slt $t5,$t1,$t4 beq $t5,$zero,OUT2 li $v0,4 la $a0,MSG4 syscall lw $t5,($t8) move $a0,$t5 li $v0,1 syscall addiu $t8,$t8,4 addiu $t1,$t1,1 j LOOP2 OUT2: li $v0,4 la $a0,MSG3 syscall j Average OUT: jr $ra L1: li $v0,4 la $a0,MSG2 syscall

Write the following in MIPS assembly and match the output exactly as shown below The program should prompt the user and read an integer value indicating n, which is the number of values to be entered. If the n value is not between 1 and 10 , then you should print an appropriate error message and exit. Otherwise, you should prompt the user and read each of the n values. You should then print the values that were even, separated by com-mas. If one or more values were even, then print the average of the even values. Enter the number of values: 5 Enter 5 integer values, one per line. 2 7 10 4 The even numbers are: 2,10,4 The average of the even numbers is: 2.66666675

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!