hey guys!..

i am writing a code that solves 6 unknowns using

gaussjordan method..

but i am stuck in making a code that swaps 2 rows

if the pivot is zero (0)..

please give me an idea how to swap a row

with zero pivot to a row that is non-zero pivot..

thanks!.

here is my code:

//manipulating the equations using Gauss-Jordan M.

i just need to put something when my matrix[m][m] = 0;Code:for (m = 1; m <= 6; m++) // number of rows { float T = matrix[m][m]; for (e = 1; e <= 7; e++) { // number of columns matrix[m][e] = matrix[m][e]/T; } // Stores Multipliers. for (r = 1; r <= 6; r++) // to create zeros below & above the diagonal. { T = matrix[r][m]; if (r != m) { for (e = 1; e <= 7; e++){ // number of columns matrix[r][e] = matrix[r][e] - (T * matrix[m][e]); } } } }

thanks in advance!.