Question: 1. Enter and modify the sum.s program to also compute and output the count and the average. 2. If no data is enter, eg. 0

1. Enter and modify the sum.s program to also compute and output the count and the average. 2. If no data is enter, eg. 0 is the first input, then output the following message and quit: No data entered 1. Enter and modify the sum.s program to also compute and output the count and the average. 2. If no data is enter, eg. Please make sure its written in MIPS assembly language

Required I/O: Sum by F. Last Enter data, use o to end input. ? # ? # ? 0 Count = # Sum = # Average = # The average is the integer average. # are user input values and program output values. sum.s .data title: asciiz "Sum by F. Last Enter data, use o to end input. " prompt: .asciiz "?" sumis: asciiz " The sum is " .text main: la li syscall $a0, title $v0, 4 # output program heading li $t0,0 # sum: to while: $a0, prompt $v0, 4 # display prompt la li syscall la syscall beqz $v0, 5 # read data $v0, endw # if data == 0, done # add input to sum $t0,$t0, $v0 while $a0, sumis $v0, 4 endw: # output result message add b la li syscall move li syscall li li syscall $a0,$t0 $v0, 1 # output sum $a0, ' ' $v0, 11 # new line li syscall $v0, 10 # exit .end main

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!