Array Challenge – Print Array in Reverse Order in Java


Hey good people, Welcome to the practice house. If you are in programming then you must be faced a lot of programming problems when studying or trying to finding a job. Similarly, I faced this challenge that I have to print an Array in Reverse order.

Problem: Given the size and the elements of array Arr, print all the elements in reverse order.

The first line of input contains, N – the size of the array.
Following N lines, each contains one integer, i{th} element of the array i.e. Arr[i].

Print all the elements of the array in reverse order, each element in a new line.

Consider the following array. The size of this array is 5. If you want to access 12, then you can access it by using arr[ 1 ] i.e. 12.

enter image description here

Java Example

Sample Output:

So in this example, we took 5 input 12,54,76,87,98 and we printed out as 98, 87, 76, 54, 12 .

We are going to solve many more problems and we will be going to share in this practice house. So keep visiting us or like our facebook page to get the notification.

If you have any comments or questions or suggestion please comments below.



Leave a Reply

Notify of