class Program {
public static void main(String[] args) {
int[][] arr = {
{1, 2, 3, 5},
{4, 5, 6, 1},
{7, 8, 9, 3}
};
int rows = arr.length;
int cols = arr[0].length;
int total = 0;
for (int i = 0; i < rows; i++) {
int sumRow = 0;
for (int j = 0; j < cols; j++) {
sumRow += arr[i][j];
}
System.out.println("Sum of row " + i + " = " + sumRow);
total += sumRow;
}
System.out.println("Total = " + total);
}
}
/*
run:
Sum of row 0 = 11
Sum of row 1 = 16
Sum of row 2 = 27
Total = 54
*/