Created
November 26, 2020 13:45
-
-
Save bagus2x/534f97e463f3d68f7fd073dcdaed276c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Main { | |
public static void main(String[] args) { | |
int nilai[][] = { | |
{15, 10, 7, 12, 25}, | |
{37, 22, 30, 17, 11}, | |
{8, 37, 4, 18, 32} | |
}; | |
int max = nilai[0][0]; | |
for(int i = 0; i < nilai[0].length; i++) { // kolom | |
for(int j = 0; j < nilai.length; j++) { | |
if(nilai[j][i] >= max) { | |
max = nilai[j][i]; | |
} | |
} | |
System.out.printf("Nilai maks kolom-%d=%d\n", i, max); | |
max = nilai[0][i]; | |
} | |
System.out.println(); | |
max = nilai[0][0]; | |
for(int i = 0; i < nilai.length; i++) { | |
for(int j = 0; j < nilai[0].length; j++) { | |
if(nilai[i][j] >= max) { | |
max = nilai[i][j]; | |
} | |
} | |
System.out.printf("Nilai maks baris-%d=%d\n", i, max); | |
max = nilai[i][0]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment