Skip to content

Instantly share code, notes, and snippets.

@mfaridzia
Created March 29, 2018 11:42
Show Gist options
  • Save mfaridzia/309d62e8250a68312e82bacd0982e3f9 to your computer and use it in GitHub Desktop.
Save mfaridzia/309d62e8250a68312e82bacd0982e3f9 to your computer and use it in GitHub Desktop.
public class SemutPekerja {
public static void main(String[] args) {
int[][] dataSet = {
{1,2,9,10,25,26}, {4,3,8,11,24,27}, {5,6,7,12,23,28},
{16,15,14,13,22,29}, {17,18,19,20,21,30}, {36, 35, 34, 33, 32, 31}
};
int x = 36;
int row = 1;
int column = 1;
if(x != 0) {
while(row <= dataSet.length) {
column = 1;
while(column <= dataSet.length) {
if(dataSet[row-1][column-1] == x) {
System.out.println(column + "," + row);
break;
}
column++;
}
row++;
}
} else {
System.out.println("END");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment