4x4 matrix in java programming
Programming

Tutor: None Selected  Time limit: 1 Day 
int [][] matrix = new int [4][4];
for(int i=0;i<4;i++){
for(int j=0;j<4;j++){
System.out.println(matrix[i][j]);
This is what I entered but just got a bunch of zeroes. I need the matrix to be 4x4 with the numbers 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16. When I run the program it needs to show the matrix, "Sum of row 1:", "Sum of row 2:" (as well as row 3 and 4), "Sum of column 1:" (and the rest of the columns), and sum of diagonals.
Thank you for the opportunity to help you with your question!
you should write this program :
to fulll the matrix :
Scanner input = new Scanner(System.in);
int [][] matrix = new int [4][4];
for(int i=0;i<4;i++){
for(int j=0;j<4;j++){
System.out.println("Enter the vlaue : ");
matrix[i][j] = input.nextLine();
}}
and you should write this to output the value :
for(int i=0;i<4;i++){
for(int j=0;j<4;j++){
System.out.print(" "+matrix[i][j]);
}
System.out.println(" ");
}
and you wiill get it as you want ok
just ask if you need something
Good Luck
Secure Information
Content will be erased after question is completed.