Ask Question
14 May, 02:33

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:

+2
Answers (1)
  1. 14 May, 04:58
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers