I have been trying to figure this out for a while and need some help. I need to find the min/max values and print them out for a multidimensional array. Here are the two way
package array;
public class Max_number {
// 2 5 7 9
// 3 6 8 1
public static void main (String []arg) {
int a[][] = {{2,5,7,9},{3,6,8,1}};
int max=a[0][0];
for (int i=0; i<2; i++) //row
{
for (int j=0; j<4; j++) //coloum
{
if(a[i][j]>max)
{
max=a[i][j];
}
}
}
System.out.println("maximum number is"+max);
}
}