You are viewing a single comment's thread. Return to all comments →
Logic in Java for reversing an array
Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int[] arr = new int[N]; for(int i=0;i<arr.length;i++) { arr[i] = scan.nextInt(); } for(int i = arr.length-1;i>=0;i--) { System.out.print(arr[i]+" "); } scan.close();
Seems like cookies are disabled on this browser, please enable them to open this website
Day 7: Arrays
You are viewing a single comment's thread. Return to all comments →