Tuesday, October 14, 2008

Program of Determinant.

void main()
{
int sum=0;p=1,i,j,k,n,X[10][10];
cout<<:Enter the determinant values:";
for(i=0; i < n;i++)
{
for(j=0;j < n;j++)
cin>>X[i][j];
}

//main concept
for(k=0;k < n;k++)
{
for(i=0,j=k; i < n;i++, j--)
{
p=p*X[i][j];
if(j==n-1)
j=0;
}
sum + =p;
p=1;
}

for(k=1; k < =n;k++)
{
for(i=0,j=n-k; i < n; i++, j--)
{
p=p*X[i][j];
if(j==0)
j=n-1;
}
sum=sum-p;
p=1;
}
getch();
}

No comments: