/**
*
* @author olivares1306
*/
public class determinant {
public static void main(String[] args) {
int or[][] = new int[3][3];
int x, y,det=0;
// Insert matrix 3x3
int[][] arre = {{3, 2, 1}, {0, 2, -5}, {-2, 1, 4}};
// Print matrix 3x3
for (x = 0; x < 3; x++) {
for (y = 0; y < 3; y++) {
System.out.print(arre[x][y] + " ");
}
System.out.println(" ");
}
//--------------
det = ((arre[0][0] * arre[1][1] * arre[2][2]) + (arre[0][1] * arre[1][2] * arre[2][0]) + (arre[0][2] * arre[1][0] * arre[2][1])) - ((arre[0][2] * arre[1][1] * arre[2][0]) + (arre[0][0] * arre[1][2] * arre[2][1]) + (arre[0][1] * arre[1][0] * arre[2][2]));
System.out.println("The determinant is: " + det);
}
}