Question: Write a program that reads a string from the user then prints it reversed.(by mips assembly language) Program Structure: Input: a string. Output: The string

Write a program that reads a string from the user then prints it reversed.(by mips assembly language)

Program Structure:

Input: a string. Output: The string after reversing it. Definitions: Define a variable to hold the string. Algorithm:

1- Read string from user. 2- Initialize index by 0 3- Do: 4- Push string[index] in stack 5- Increment index

6- Repeat until string[index]=" " 7- Initialize index by 0 again 8- Do: 9- Pop from stack

10- Store in string[index] 11- Increment index 12- Repeat until stack empty 13- Print string

Sample Run:

 Write a program that reads a string from the user then

Please enter a string: computer The string after reversing it is : retupmoc

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!