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 revers
e. The program repeats, ending when the user enters "Quit", "quit", or "q" for the line of text. Ex: If the input is:
1 answer:
Answer:
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();
}
}
}
You might be interested in
Uh how do you get a little blue box in a sandwich
A person who designs, maintains or builds machines.
Answer: Eight
Explanation:
A class B address is 255.255.0.0. We need to borrow 8 bits from the network portion to have atleast 130 host per subnet.
11111111.00000000.00000000.00000000
A range of position dependent colors
Answer:
- They write step by step instructions for a computer to follow.
- They create a logic problem that the computer program can solve.