Task
Given an array, , of integers, print 's elements in reverse order as a single line of space-separated numbers.
Input Format
The first line contains an integer, (the size of our array).
The second line contains space-separated integers describing array 's elements.
The second line contains space-separated integers describing array 's elements.
Constraints
- , where is the integer in the array.
Output Format
Print the elements of array in reverse order as a single line of space-separated numbers.
JAVA Programimport java.util.*;public class ArrayExample {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();}for(int j=n-1;j>=0;j--){System.out.print(arr[j]+" ");}in.close();}}
Thanks to share these details it’s truly nice.
ReplyDeleteux design firm san francisco
Thanks for sharing the best information and suggestions, If you are looking for the best Tree Interview Questions, then TutorialCup. Highly energetic blog, I’d love to find out some additional information.
ReplyDelete