void getCofactor(int A[N][N], int temp[N][N], int p, int q, int n){
int i = 0, j = 0;
for (int row = 0; row < n; row++){
for (int col = 0; col < n; col++){
if (row != p && col != q){
temp[i][j++] = A[row][col];
if (j == n - 1){
j = 0;
i++;
}
}
}
}
}
Find co-factor in matrix
Cpp recipesThis code is used to find the cofactor of an equation. It takes in an equation with n rows and n columns and calculates the cofactor for each row and column.
0 Comments
Add Comment
Log in to add a comment