#include #include #include #include int n; float mat[10][10]; float ans[10]; void swaprows(int r1,int r2) { int i; float temprow[10]; for(i=0;i<=n;i++) temprow[i]=mat[r1][i]; for(i=0;i<=n;i++) mat[r1][i]=mat[r2][i]; for(i=0;i<=n;i++) mat[r2][i]=temprow[i]; } void checkmat(int c) { int i; if(mat[c][c]==0) { if(c==n-1) { printf("\nThe system of linear equations is inconsistent"); exit(1); } for(i=c+1;i<=n-1;i++) { if(mat[i][c]!=0) { swaprows(c,i); break; } } checkmat(c); } } void getmat() { int i,j; printf("Enter the number of variables: "); scanf("%d",&n); printf("\nEnter the coefficients along with the constant at the end:\n\n"); for(i=0;i=0;i--) { for(j=i+1;j