import java.util.Arrays;
public class Main {
// ForExercises
public static void main
(String[] args
) { int[][] array = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}};
int sum = 0;
int length = array[0].length;
int height = array.length;
for (int i = 0; i < length; i++) {
for (int j = 0; j < height; j++) {
sum = sum + array[j][i];
}
}
System.
out.
println("Sum = " + sum
); }
}
aW1wb3J0IGphdmEudXRpbC5BcnJheXM7CgpwdWJsaWMgY2xhc3MgTWFpbiB7CgkvLyBGb3JFeGVyY2lzZXMKCQoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHsKCQlpbnRbXVtdIGFycmF5ID0ge3sxLCAyLCAzfSwgezQsIDUsIDZ9LCB7NywgOCwgOX0sIHsxMCwgMTEsIDEyfX07CgkJCgkJCVN5c3RlbS5vdXQucHJpbnRsbihBcnJheXMudG9TdHJpbmcoYXJyYXlbMF0pKTsKCQkJU3lzdGVtLm91dC5wcmludGxuKEFycmF5cy50b1N0cmluZyhhcnJheVsxXSkpOwoJCQlTeXN0ZW0ub3V0LnByaW50bG4oQXJyYXlzLnRvU3RyaW5nKGFycmF5WzJdKSk7CgkJCVN5c3RlbS5vdXQucHJpbnRsbihBcnJheXMudG9TdHJpbmcoYXJyYXlbM10pKTsKCQkJCgkJCWludCBzdW0gPSAwOwoJCQlpbnQgbGVuZ3RoID0gYXJyYXlbMF0ubGVuZ3RoOwoJCQlpbnQgaGVpZ2h0ID0gYXJyYXkubGVuZ3RoOwoJCQlTeXN0ZW0ub3V0LnByaW50bG4obGVuZ3RoKTsKCQkJU3lzdGVtLm91dC5wcmludGxuKGhlaWdodCk7CgkJCQoJCQkKCQkJZm9yIChpbnQgaSA9IDA7IGkgPCBsZW5ndGg7IGkrKykgewoJCQkJZm9yIChpbnQgaiA9IDA7IGogPCBoZWlnaHQ7IGorKykgewoJCQkJCXN1bSA9IHN1bSArIGFycmF5W2pdW2ldOwoJCQkJfQoJCQl9CgkJCQoJCQlTeXN0ZW0ub3V0LnByaW50bG4oIlN1bSA9ICIgKyBzdW0pOwoJfQp9