import java.util.Scanner; class determinant5 { int n=5; int i,j ; double arr[][]=new double[n][n]; for( i=0;i<n;i++) { for( j=0;j<n;j++) { arr [i][j]=hs.nextInt(); } } for( i=0;i<n;i++) { for( j=0;j<n;j++) { } } double arr1[][]=new double[n][n]; for(i=1;i<n;i++) { for(j=1;j<n;j++) { arr1[i][j]=arr[0][j]-((arr[0][0]/arr[i][0])*arr[i][j]); } } double arr2[][]=new double[n][n]; for(i=2;i<n;i++) { for(j=2;j<n;j++) { arr2[i][j]=arr1[1][j]-((arr1[1][1]/arr1[i][1])*arr1[i][j]); } } double arr3[][]=new double[n][n]; for(i=3;i<n;i++) { for(j=3;j<n;j++) { arr3[i][j]=arr2[2][j]-((arr2[2][2]/arr2[i][2])*arr2[i][j]); } } double arr4[][]=new double[n][n]; for(i=4;i<n;i++) { for(j=4;j<n;j++) { arr4[i][j]=arr3[3][j]-((arr3[3][3]/arr3[i][3])*arr3[i][j]); } } double k=arr[0][0]*arr1[1][1]*arr2[2][2]*arr3[3][3]* arr4[4][4]; } }
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
enter the element a[ 1,1] enter the element a[ 1,2] enter the element a[ 1,3] enter the element a[ 1,4] enter the element a[ 1,5] enter the element a[ 2,1] enter the element a[ 2,2] enter the element a[ 2,3] enter the element a[ 2,4] enter the element a[ 2,5] enter the element a[ 3,1] enter the element a[ 3,2] enter the element a[ 3,3] enter the element a[ 3,4] enter the element a[ 3,5] enter the element a[ 4,1] enter the element a[ 4,2] enter the element a[ 4,3] enter the element a[ 4,4] enter the element a[ 4,5] enter the element a[ 5,1] enter the element a[ 5,2] enter the element a[ 5,3] enter the element a[ 5,4] enter the element a[ 5,5] the matrix form is : 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 the determinant is: NaN