We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public class Solution {
public static void main(String[] args) throws IOException {
//import scanner that is scan
Scanner scan = new Scanner(System.in);
//input n
int n = scan.nextInt();
//array initialize
int[] arr = new int[n];
// for loop for array
for(int i=0; i<n; i++){
arr[i] = scan.nextInt();
}
// for loop for reversing which will print the input in reversed order
for(int i = n-1; i>=0;i--){
System.out.print(arr[i]+ " ");
}
scan.close();
}
}****
Cookie support is required to access HackerRank
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 →
Simple and easy to understand-
public class Solution { public static void main(String[] args) throws IOException {
}****