JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class Program {
public static void main(String[] args) {
int a[][] = {
{1,2,3,23},
{8,10,5,3,45,90},
{-9,56,0},
{33,56,-77,88}
};
/* Thanks to Shardis Wolfe's correction */
// wrong if 0 is not in the array
//int small = 0;
// wrong if all numbers are negative
//int large = 0;
// better starting value:
int small = a[0][0];
int large = a[0][0];
for(int[] row: a) {
for(int n: row) {
if(n > large)
large = n;
if(n < small)
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run