Question: Code not working, need help to print output, #Enter three characters: #Displays them in reverse order .data s1: .asciiz Enter three characters: s2: .asciiz
Code not working, need help to print output,

#Enter three characters:
#Displays them in reverse order
.data
s1: .asciiz "Enter three characters: "
s2: .asciiz "Your characters in reverse order: "
char: .space 3
.text
li $v0, 4 #system call code fot print_str
la $a0, s1 #printing on screen s1
syscall
li $v0, 8 #system call code for reading from keyboard the three chars
la $a0, char
li $a1, 4
syscall
li $v0, 11 #system call code for creating a new line
la $a0, ' '
syscall
li $v0, 4 #displays second string
la $a0, s2
syscall
la $t0, char
li $v0, 11 #prints 3rd char, this part is not working. I dont know why. Is there a better way to access the characters in the string?
lb $a0, 3($t0)
syscall
lb $a0, 2($t0) #prints 2nd char
syscall
lb $a0, ($t0) #prints 1st char
syscall
Q1. Write a MIPS program that prompts the user to enter 3 characters and then displays them in reverse order. Sample run nter three characters: xyz Your characters in reverse order zyx
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
