C program to calculate the determinant of 2*2 matrix
| #include<stdio.h> #include<conio.h> int main() { int a[2][2], i, j, d, e, c; printf("\n Enter elements of 2*2 matrix"); for(i=0;i<2;i++) // outer loop for taking row input { for(j=0;j<2;j++) // iner loop for taking colume input { scanf("%d", &a[i][j]); } } for(i=0;i<2;i++) { for(j=0;j<2;j++) { c= (a[0][0]*a[1][1]); e= (a[0][1]*a[1][0]); d=c-e; } } printf("\n Determinant of 2*2 matrix is %d", d); getch(); } |



0 Comments
Please do not enter any spam link on comment box