   0

# Calculate determinants of a nxn matrix in C programming?

from:

http://local.wasp.uwa.edu.au/~pbourke/other/determinant/

/*

Recursive definition of determinate using expansion by minors.

*/

double Determinant(double **a,int n)

{

int i,j,j1,j2;

double det = 0;

double **m = NULL;

if (n < 1) { /* Error */

} else if (n j1)

continue;

m[i-1][j2] = a[i][j];

j2++;

}

}

det += pow(-1.0,1.0+j1+1.0) * a[j1] * Determinant(m,n-1);

for (i=0;i<n-1;i++)

free(m[i]);

free(m);

}

}

return(det);

}

//New Answer By Shaikh SOHIAL Hussain form Pakistan

#include<stdio.h>

#include<conio.h>

void main ()

{ clrscr();

int a,row,i=0,j=0,result,w,x,y,z;

printf("This Program made 4 solve matrix determintae\n");

scanf("%d",&row);

while(i<row)

{printf("\n");

for(j=0;j<row;j++)

{ printf("Enter the value of %d%d\n",i,j);

scanf("%d",&a[i][j]);

}

i++;

}

i=0;

while(i<row)

{ printf("\n");

j=0; while( j<row)

{printf("%d",a[i][j]);

printf(" ");printf(" ");

j++;}

i++;

}

if(row==2)

{

result=(a*a)-(a*a);

}

else if(row==3)

{ result=(a*((a*a)-(a*a))) - (a*((a*a)-(a*a))) + (a*((a*a)-(a*a)));

}

else if(row==4)

{

w=a*(a*(a*a-a*a)-a*(a*a-a*a)+a*(a*a-a*a));

x=a*(a*(a*a-a*a)-a*(a*a-a*a)+a*(a*a-a*a));

y=a*(a*(a*a-a*a)-a*(a*a-a*a)+a*(a*a-a*a));

z=a*(a*(a*a-a*a)-a*(a*a-a*a)+a*(a*a-a*a));

result=w-x+y-z;

printf("\n The answer is \t %d", result);

}

else{ printf("Determinate Limit is 4*4 max\n");

getch();

} Study guides

20 cards

## A number a power of a variable or a product of the two is a monomial while a polynomial is the of monomials

➡️
See all cards
3.75
844 Reviews Earn +20 pts  