public class Reverse {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter Size of an Array :");
int n = sc.nextInt();
int arr[] = new int[n];
System.out.println("Enter Array elements :");
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
for (int i = n-1; i >= 0; i--) {
System.out.println("Reverse elements are :" + arr[i]);
}
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter Size of an Array :");
int n = sc.nextInt();
int arr[] = new int[n];
System.out.println("Enter Array elements :");
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
}
for (int i = n-1; i >= 0; i--) {
System.out.println("Reverse elements are :" + arr[i]);
}
}
}
0 comments:
Post a Comment