forked from SoumyadeepMukherjee/Matrix_Manipulation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeterminantMatrix.c
More file actions
32 lines (25 loc) · 813 Bytes
/
DeterminantMatrix.c
File metadata and controls
32 lines (25 loc) · 813 Bytes
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
30
31
32
/**
------------------------------------------------------------------------------------------------
DESCRIPTION: PROGRAM TO FIND THE DETERMINANT OF A 2X2 MATRIX
------------------------------------------------------------------------------------------------
**/
#include <stdio.h>
#define MATRIX_SIZE 2
int main()
{
int A[MATRIX_SIZE][MATRIX_SIZE];
int row, column;
long determinant;
/* Input elements in matrix A from user */
printf("Enter elements in matrix of size 2x2: \n");
for(row=0; row<MATRIX_SIZE; row++)
{
for(column=0; column<MATRIX_SIZE; column++)
{
scanf("%d", &A[row][column]);
}
}
determinant = (A[0][0] * A[1][1]) - (A[0][1] * A[1][0]);
printf("Determinant of matrix A = %ld", determinant);
return 0;
}