/*to get determinant value of a 3x3 matrix*/
#include
#include
#include
main()
{
int a[3][3],i,j,k,p,sum=0;
clrscr();
printf("enter elements of a 3x3 matrix");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
}}
/*determinant value*/
for(i=0;i<3;i++)
{
j=1;
if(i!=0)
{
j=0;
}
k=2;
if(i==2)
{
k=1;
}
p=pow(-1,i);
sum=sum+p*( (a[0][i])* ((a[1][j]*a[2][k])-(a[1][k] * a[2][j]) ) ) ;
}
printf("\nthe determinant value is %d",sum);
getch();
}
Hope this program'll help u. But this program is limited for 3x3 matrices only. If u want to find determinant of any NxN matrix (generalized case), u have to use "calloc" function.
2006-10-02 05:35:07
·
answer #1
·
answered by Innocence Redefined 5
·
0⤊
1⤋
expand a determinant by letters.
Then enter the values. Calculate det.
ex:
a b
c d
det=a*d-b*c
1 2
3 4
1*4-3*2=-2
2006-10-02 05:09:30
·
answer #2
·
answered by iyiogrenci 6
·
0⤊
1⤋
http://www.google.co.uk/search?hl=en&q=solve+determinant&btnG=Search&meta=
There a loads of sites that give the math here.
Rawlyn.
2006-10-02 04:27:04
·
answer #3
·
answered by Anonymous
·
0⤊
1⤋