#1
 Rilex Member Join Date: Apr 2009 Posts: 29
Calculating Matrix Determinant in C

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  )
(
return ((m   * m  ) - (m   * m  ));
)
void main ()
(
int M  , 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;
)```
#2
 Katty Member Join Date: May 2008 Posts: 2,008
Re: Calculating Matrix Determinant in C

Debug :

Code:
```  E: \ l Angaga C \ a \ main.c | 13 | warning: return type of 'main' is not `int '|
E: \ C \ a \ main.c | | In function `main ': |
E: \ l Angaga C \ a \ main.c | 25 | warning: `return 'with a value, in function returning void |```
0 errors with 2 warnings
#3
 Zecho Member Join Date: May 2008 Posts: 2,293
Re: Calculating Matrix Determinant in C

For additional dimensions, we can easily do so by recursion (through the development of row or column), although this is not really optimal.
#4
 Rilex Member Join Date: Apr 2009 Posts: 29
Re: Calculating Matrix Determinant in C

Code:
` int main (void);`

and warnings disappears!

in the running it gives:

Code:
``` Donez the value of M  : 1
Donez the value of M  : 2
Donez the value of M  : 3
Donez the value of M  : 4
and -5 determine the```

 Tags:

 Thread Tools Search this Thread Show Printable Version Email this Page Search this Thread: Advanced Search Similar Threads for: "Calculating Matrix Determinant in C" Thread Thread Starter Forum Replies Last Post New Matrix Movie (Matrix ReEntered) Vicious Off Topic Chat 8 08-02-2011 08:24 PM Any fastest way to compute 3x3 Matrix inverse and Matrix multiplication? Logan.B Software Development 4 25-09-2010 05:11 PM Calculating Age in java Miles Runner Software Development 5 03-02-2010 01:54 AM Calculating identity matrix with static method in C Measurer Software Development 5 29-01-2010 06:47 PM Calculating the sum of two polynomials Liquid Shadow Software Development 3 30-11-2009 12:12 PM

All times are GMT +5.5. The time now is 01:04 PM.