Answer:
See explaination
Step-by-step explanation:
MIPS PROGRAM :-
.data
y: .word 0x32774b33
z: .word 0x2a276c39
y_prompt: .asciiz "Y= "
z_prompt: .asciiz "Z= "
new_line: .asciiz "\\"
.text
main:
la $s0, y
la $s1, z
li $t0, 8
loop:
beqz $t0, END_OF_LOOP
# checking fo y word
lb $t1, 0($s0)
#checking for whether the byte is decimal or not
li $t2, '0'
bltu $t1, $t2, check_for_z
li $t2, '9'
bltu $t2, $t1, check_for_z
#print new line
li $v0, 4
la $a0, new_line
syscall
#print y prompt
li $v0, 4
la $a0, y_prompt
syscall
#print the value
li $v0, 1
add $a0, $zero, $t1
syscall
check_for_z:
# checking fo z word
lb $t1, 0($s1)
#checking for whether the byte is decimal or not
li $t2, '0'
bltu $t1, $t2, next_element
li $t2, '9'
bltu $t2, $t1, next_element
#print new line
li $v0, 4
la $a0, new_line
syscall
#print y prompt
li $v0, 4
la $a0, z_prompt
syscall
#print the value
li $v0, 1
add $a0, $zero, $t1
syscall
next_element:
addi $s0, $s0, 1
addi $s1, $s1, 1
#decrease the counter
addi $t0, $t0, -1
j loop
END_OF_LOOP:
li $v0,10
syscall