Enter a 2x2 matrix of integers, calculate and display the determinant.
Tables with more than two dimensions: Proceed in the same way by adding elements of design.That restores my C code but I don't know what is the problem in the code.
Code:
# include <stdio.h>
# include <conio.h>
int determinant (int m [1] [1])
(
return ((m [0] [0] * m [1] [1]) - (m [1] [0] * m [0] [1]));
)
void main ()
(
int M [1] [1], i, j;
for (i = 0; i <= 1; i + +)
for (j = 0 j <= 1 j + +)
(
printf ( "Donez the value of M [% d] [% d]:", i + 1, j + 1);
scanf ( "% d", & M [i] [j]);
)
printf ( "and determine the% d", determinant (M));
getch ();
return 0;
)
Bookmarks