Invers Matrix

Posted by Bl4ckB0y On 17.24 0 comments

THE INVERS OF MATRIX USING GAUSS-JORDAN METHODE
/* CALCULATE THE INVERS OF MATRIX USING GAUSS-JORDAN METHODE*/
/*it compile using devC++ you, it implement methode of gauss jordan to invers matrix*/
#include "stdio.h"
#include "conio.h"
main(void)
{ int p[20], a[20][20], t;
int m, i, j, k, x;
printf("\ninsert size of matrix : \n");
scanf("%d", &m);
printf("\ninsert the matrix element step by step");
/* read the matrix */
for(i=1; i<=m; i++)
{ printf("\n");
for(j=1; j<=m; j++)
{ printf("A(%d,%d)= ",i, j);
scanf("%d", &a[i][j]);
}
}
/* print the matrix to konsole*/
printf("\nthe matrix: ");
for(i=1; i<=m; i++)
{ printf("\n");
for(j=1; j<=m; j++)
printf(" %2d", a[i][j]);
}
/* invertions proses */
for(i=1; i<=m; i++)
{ p[i] = a[i][j];
a[i][j] = 1;
for(j=1; j<=m; j++)
{ a[i][j] = a[i][j]/p[i];
}
for(k=1; k<=m; k++);
{ if(k != i)
{ t = a[k][i];
a[k][i] = 0;
for(x=1; x<=m; x++)
a[k][x] = a[k][x] - a[i][x] * t;
}
}
}
/* print the invertions matrix to konsole*/
printf("\n\invertion matrix : \n");
for(i =1; i <=m; i++)
{ for(j=1; j<=m; j++)
printf(" %d", a[i][j]);
printf(" \n");
}
getch();
}

Categories:

0 Response for the "Invers Matrix"

Posting Komentar

your Ads Here

Your Ad Here FellowEquality.com