Skip to content

Instantly share code, notes, and snippets.

@meyerzinn
Created June 12, 2014 14:54
Show Gist options
  • Save meyerzinn/96c539de0438a7abfc6c to your computer and use it in GitHub Desktop.
Save meyerzinn/96c539de0438a7abfc6c to your computer and use it in GitHub Desktop.
int a[][] = new int[3][5];
a[0][0] = 1;
a[0][1] = 2;
a[0][2] = 3;
a[0][3] = 5;
a[1][0] = 4;
a[1][1] = 5;
a[1][2] = 6;
a[1][3] = 7;
a[2][0] = 3;
a[2][1] = 9;
a[2][2] = 4;
a[2][3] = 1;
int i;
int j;
for (i = 0; i < a.length; i++) {
int sum = 0;
for (j = 0; j < a[i].length; j++) {
sum = sum + a[i][j];
System.out.print(" " + a[i][j]);
}
System.out.println(" = " + sum);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment