Hello everybody
I need help, I got a problem with this matrix, I need to have it in this way:
1 2 3 4 = 10 2 4 6 8 = 20 3 6 9 12 = 30 4 8 12 16 = 40
But I have it in this way:
1 2 3 4 1 2 4 6 8 2 3 6 9 12 3 4 8 12 16 4
I dont know how can we do that, I intent but nothing
This is my code:
public class Matrix {
public static void main(String args[]) {
int mult = 4;
for (int i = 1; i <= mult; i++) {
// System.out.println();
for (int j = 1; j <= mult; j++) {
int operacion = i * j;
int suma = 0;
suma = operacion + suma;
System.out.print(operacion + " ");
}
int sum = 0;
sum = i + sum;
System.out.println(sum);
}
}
}
bye