Ask Question
20 March, 12:30

4.24 LAB: Print string in reverse Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is:

+4
Answers (1)
  1. 20 March, 15:40
    0
    See explaination

    Explanation:

    import java. util. Scanner;

    public class LabProgram {

    public static void main (String[] args) {

    Scanner in = new Scanner (System. in);

    String line;

    while (true) {

    line = in. nextLine ();

    if (line. equals ("quit") || line. equals ("Quit") || line. equals ("q")) break;

    for (int i = 0; i < line. length (); i++) {

    System. out. print (line. charAt (line. length () - i - 1));

    }

    System. out. println ();

    }

    }

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “4.24 LAB: Print string in reverse Write a program that takes in a line of text as input, and outputs that line of text in reverse. The ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers