#Application 16 .text 0x00400000 #Code section #Display the message "N=" li $v0,4 #Load the function number la $a0,read_n #Load the message starting address syscall #Function call #Read number for multiplication li $v0,5 #Load the function number syscall #Function call move $t4,$v0 #Load the number in $t4 #Fill array li $t2,1 #Numbers counter li $t1,0 #Deviation counter start: #Display the message "Pos[" li $v0,4 #Load the function number la $a0,m1 #Load the message starting address syscall #Function call #Display current array location li $v0,1 #Load the function number move $a0,$t2 #Load the number to be displayed syscall #Function call #Display the message "]=" li $v0,4 #Load the function number la $a0,m2 #Load the message starting address syscall #Function call #Read number for array li $v0,5 #Load the function number syscall #Function call move $t0,$v0 #Load the number in $t0 sw $t0,arrayA($t1) #Store the number starting #from the address arrayA+$t1 add $t1,$t1,4 #Update deviation counter add $t2,$t2,1 #Update numbers counter ble $t2,10,start #While all the numbers have #not been read, go to start li $t2,1 #Numbers counter li $t1,0 #Deviation counter start2: lw $t0,arrayA($t1) #Read number from array mul $t3,$t0,$t4 #Multiply array elements #with number sw $t3,arrayA($t1) #Store the result #in the same array location lw $t0,arrayA($t1) #Read again from array #Display results from array li $v0,1 #Load the function number move $a0,$t0 #Load the number to be displayed syscall #Function call #Display a space character li $v0,4 #Load the function number la $a0,spacechar #Load the message starting address syscall #Function call add $t1,$t1,4 #Update deviation counter add $t2,$t2,1 #Update numbers counter ble $t2,10,start2 #While all the numbers have #not been read, go to start2 li $v0,10 #Program termination syscall #Function call .data #Data section spacechar: .asciiz " " .align 2 arrayA: .space 40 m1: .asciiz "Pos[" m2: .asciiz "]=" read_n: .asciiz "N="