REVERSE ORDER OF THE ARRAY BY TAKING INPUT FROM USER IN JAVA?


INPUT:-

import java.util.Scanner;

public class example{  

public static void main(String args[]){  

Scanner sc = new Scanner(System.in);

int n[]= new int[5];

int i;

int r=1;

System.out.println("Enter your elements : ");

for(i=0;i<5;i++){

   n[i]=sc.nextInt();

}

 for(i=4;i>=0;i--){

 System.out.println("Your number is : " + n[i]);

 }

 }

}  


OUTPUT:-