Answer:
.data
array: .word 1,3,5,7,9,11,13,15,17,19
result: .word 0,0,0,0,0,0,0,0,0,0
.text
la $s0, array
la $s1, result
addi $t0, $zero, 0
INTERVAL: bge $t0, 10, END
sll $t1, $t0, 2
add $t2, $s0, $t1
lw $t2, 0($t2)
jal LIMIT
IF: bne $a0, 1, ELSE
add $t3, $s1, $t1
sw $t2, 0($t3)
ELSE:
addi $t0, $t0, 1
j INTERVAL
END:
addi $v0, $zero, 10
syscall
LIMIT:
addi $a0, $zero, 0
START: bge $t2, 0, NEXT
b ENDLIMIT
NEXT: ble $t2, 10, SET
b ENDLIMIT
SET: addi $a0, $zero, 1
ENDLIMIT:
jr $ra
Explanation:
The assembly source code is used to create a subroutine called "INTERVAL" that checks if a number from an array is in a range of 1 to 10. The program returns 1 if the condition is met but 0 if otherwise.