Created
July 19, 2017 13:47
-
-
Save crissyg/87e26be2089be7546324232ac8201e84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Day 7 Hackerrank | |
/*Description: Given an array,A , of N integers, print 's elements in reverse order as a single line of space-separated numbers. | |
Input Format | |
*/ | |
//by crissyg | |
import java.io.*; | |
import java.util.*; | |
public class Solution { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
int n = in.nextInt(); | |
int[] arr = new int[n]; | |
for(int i=0; i < n; i++){ | |
arr[i] = in.nextInt(); | |
} | |
in.close(); | |
for(int r=(arr.length-1); r >=0; r--){ | |
System.out.print(arr[r]+" "); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment