<pre>public void readAndReverse(int n) { int[] numbers = new int[n]; Scanner scanner = new Scanner(System.in); // Read n integers into an array for (int i = 0; i < n; i++) { numbers[i] = scanner.nextInt(); } // Prints n integers in reverse order for( int i = 0; i < n; i++) { System.out.print(numbers[i] + " "); Collections.reverse(numbers[i]); } }
for( int i = n - 1; i >= 0; i--) ....
N - 1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)