Wednesday, September 10, 2014
Read Inverse
public static void main(String args[]) throws IOException {
String num[] = new String[5];
boolean choose = false;
String ask;
int l = num.length;
BufferedReader z = new BufferedReader(new InputStreamReader(System.in));
while (!choose) {
for (int i = 0; i < l; i++) {
System.out.print(" Enter a number or String : ");
num[i] = z.readLine();
}
System.out.println(" The oppossing order of the given numbers are : ");
for (int i = l - 1; i >= 0;) {
System.out.print(" " + num[i]);
i--;
}
System.out.println(" \n" + "Do you want to try again ? (y/n) ");
ask = z.readLine();
if (ask.equals("y")) {
choose = false;
} else if (ask.equals("n")) {
choose = true;
}
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment