Numerical Methods: Determinant of nxn matrix using C
destination source:https://www.programming-techniques.com/2011/09/numerical-methods-determinant-of-nxn-matrix-using-c.html
Source Code:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include<stdio.h> int main(){ float matrix[10][10], ratio, det; int i, j, k, n; printf("Enter order of matrix: "); scanf("%d", &n); printf("Enter the matrix: \n"); for(i = 0; i < n; i++){ for(j = 0; j < n; j++){ scanf("%f", &matrix[i][j]); } } /* Conversion of matrix to upper triangular */ for(i = 0; i < n; i++){ for(j = 0; j < n; j++){ if(j>i){ ratio = matrix[j][i]/matrix[i][i]; for(k = 0; k < n; k++){ matrix[j][k] -= ratio * matrix[i][k]; } } } } det = 1; //storage for determinant for(i = 0; i < n; i++) det *= matrix[i][i]; printf("The determinant of matrix is: %.2f\n\n", det); return 0; } |

Related Article
destination source:https://www.programming-techniques.com/2011/09/numerical-methods-determinant-of-nxn-matrix-using-c.html