Write a program to find m rows n columns of two-dimensional maximum of all elements in the array, the input line m + 1: the value of the first behavior of m and n, the following m lines for two-dimensional arrays, each line including n number,
For example, enter the following
3 3
1 2 3
4 5 6
7 8 9
The first line of 3 3 means 3 rows 3 columns
The output of
9
Enter
3 3
1 2 3
4 5 6
7 8 9
O
9
The sample input
3 3
1 2 3
4 5 6
7 8 9
Sample output
9
Procedure is as follows:
# include & lt; Stdio. H>
# define N 100
Void main ()
{
Int a [N] [N], n1, and n2, I, j, Max, t;
The scanf (" % d % d ", & amp; N1, & amp; N2);//the row and column of the input array
for(i=0; i
Max=a [0] [0];
for(i=0; i
T=a, [I] [j].
A [I] [j]=Max;
Max=t;
}
Printf (" % d \ n ", Max).//the biggest number in the output array
}
CodePudding user response:
# include & lt; Stdio. H>
# define N 100
Int main ()
{
Int a [N] [N], n1, and n2, I, j, Max, t;
The scanf (" % d % d ", & amp; N1, & amp; N2);//the row and column of the input array
If (n1 & gt; N)
N1=N;
If (n2 & gt; N)
N2=N;
for(i=0; ifor(j=0; j The scanf (" % d ", & amp; A [I] [j]);
Max=a [0] [0];
for(i=0; ifor(j=0; j If (max{
Max=a, [I] [j].
/*
T=a, [I] [j].
A [I] [j]=Max;
Max=t;
*/
}
Printf (" % d \ n ", Max).//the biggest number in the output array
}
For your reference ~
CodePudding user response:
The