Nakagawa Yuuki Nakagawa Yuuki - 4 months ago 51
C Question

How to calculate Determinant Matrix 2x2 -C

So I need to calculate the determinant matrix on 2x2 matrix, simple one..
If you can, please write the code, because i don't understand like in the other thread, it's like i'm reading an English Literature + Code..


int main(){
int x[2][2]={{1,2},{3,4}};
int i,j,d;

printf(" %d ", x[i][j]);
printf(" \n");

return 0;

Thank You!


You don't need a loop to calculate the determinant of a 2x2 matrix, simply use:

int result = (x[0][0] * x[1][1]) - (x[0][1] * x[1][0]);