- Home
- Course Category
- Course Result
- Course Detail
Hot Line: 0124-2383121
Course Introduction
Includes
Certificate & Practice Material
Programs for practice
In the program below, we've introduced beginers to programming in java
Source Code: Program to find reverse of a matrix
# Program to find reverse of a matrix in java
public class reverseArray {
public static void main(String[] args)
{
int [] arr = {10, 20, 30, 40, 50}; // try taking the input from user
int n= arr.length;
int[] b = new int[n];
int j = n;
for (int i = 0; i < n; i++) {
b[j - 1] = arr[i];
j = j - 1;
}
// printing the reversed array
System.out.println("Reversed array is: \n");
for (int k = 0; k < n; k++) {
System.out.println(b[k]);
}
}
}
Output
Run the program to see the OUTPUT