# Program to find minimum and maximum element of a matrix.

```import java.io.*;
class test
{
public static void main(String[] asd)throws IOException
{
System.out.println("Enter the values of Rows and Columns of Matrix.");
int r=Integer.parseInt(num);
int c=Integer.parseInt(num);
int m[][]= new int[r][c][/c];
int  max, min;
System.out.println("Enter the values of the matrix not more then "+(r*c)+".");
for(int i=0;i<r;i++)
for(int j=0;j<c;j++)
{
m[i][j]=Integer.parseInt(num);
}
System.out.println("Original matrix::");
for(int i=0;i<r;i++)
{    for(int j=0;j<c;j++)
{
System.out.print(m[i][j]+"    ");
}
System.out.println();
}
// MAXIMUM element of the matrix
max=m[0][0];
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
if(m[i][j]>max)
max=m[i][j];
}
}
System.out.println("Maximum of the matrix is "+max+".");
//MINIMUM element of the matrix
min=m[0][0];
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
if(m[i][j]<min)
min=m[i][j];
}
}
System.out.println("Minimum of the matrix is "+min+".");

}

}
```