Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.Scanner;
- public class ex1 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int n = Integer.parseInt(scan.nextLine());
- int[] array = new int[n] ;
- int length = array.length;
- int[] reversed = new int[length];
- for (int index = 0; index < length; index++) {
- reversed[length - index - 1] = array[index];
- }
- System.out.println(Arrays.toString(reversed));
- }
- }
Add Comment
Please, Sign In to add comment