Archived
22 lines
626 B
C
Executable File
22 lines
626 B
C
Executable File
/*
|
|
19.Вычислить определитель матрицы 3x3.
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#define N 3
|
|
|
|
int getDet(int (*matrix)[N]) {
|
|
return matrix[0][0]*matrix[1][1]*matrix[2][2] + matrix[0][1]*matrix[1][2]*matrix[2][0] + matrix[0][2]*matrix[1][0]*matrix[2][1] - matrix[0][2]*matrix[1][1]*matrix[2][0] - matrix[0][1]*matrix[1][0]*matrix[2][2] - matrix[0][0]*matrix[1][2]*matrix[2][1];
|
|
}
|
|
|
|
|
|
int main() {
|
|
int matrix[N][N] = {{6, 3, 0},
|
|
{4, 1, -3},
|
|
{-2, -3, 2}
|
|
};
|
|
|
|
printf("Det: %d", getDet(matrix));
|
|
return 0;
|
|
} |