I am having trouble making this recursive C function work for square matrices of size greater than 3 rows and columns. 
#include<stdio.h>

#include<conio.h>

#include<math.h>

int M[100];

float DET(float A[][100],int dim)

{

int i=100,j,k,l;

static int det=0;

static int DIM=dim;

if(dim>2)

for(i=0;i<DIM;i++)

{

if(i==0&&DIM==dim)for(j=0;j<100;j++)M[j]=100;

for(j=DIM1;j>=2;j)

if(M[j]==i)continue;

M[dim1]=i;

det+=pow(1,i+dim1)*A[dim1][i]*DET(A,dim1);

}

if(i==DIM1)M[dim1]=100;

if(dim==2)

{

for(i=0;i<DIM;i++)

{

k=0;

for(j=DIM1;j>=2;j)

if(i!=M[j])k++;

if(k==DIM2)break;

}

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

{

k=0;

for(l=DIM1;l>=2;l)

if(j!=M[l])k++;

if(k==DIM2&&j!=i)break;

}

return(A[0][i]*A[1][j]A[0][j]*A[1][i]);

}

if(dim==1)return(A[0][0]);

return(det);

}



void main()

{

float A[100][100];

int n,k,l;

puts("Input size of square matrix:");

scanf("%d",&n);

puts("Input square matrix:");

for(k=0;k<n;k++)

{

printf("\n");

for(l=0;l<n;l++)

{

printf("Input a%d%d: ",k+1,l+1);

scanf("%f",&A[k][l]);

}

}

printf("\n\nThe determenant of the matrix is %0.2f",DET(A,n));

getch();

}

If anyone can tell me where I went wrong in writing the program I would be grateful.
P.S.:Here are some points to make the program clearer:
_This program works by using method of minor.
_M[100] is an array of integers used to store in decreasing order of its elements which column in the matrix does not belong to the minor associated with the element chosen on a certain row.
_In the function, dim represents wich row is being used, while i(in the first for loop) represents which column is being used.
29 13814
As noted in a recent thread, finding the determinant by a minors expansion is very slow (O(n!) for an nxn matrix), there are much better methods like the finding the LU decomposition which is O(n^3). Also, there are a number of libraries which can do all this for you, such as GSL.
As noted in a recent thread, finding the determinant by a minors expansion is very slow (O(n!) for an nxn matrix), there are much better methods like the finding the LU decomposition which is O(n^3). Also, there are a number of libraries which can do all this for you, such as GSL.
I know there are other methods , but I want to use this one, so please read the program and try it and maybe you'll know what's wrong with it.
What kind of problems are you having with your code? Does it compile? Does it give you the wrong answer?
What kind of problems are you having with your code? Does it compile? Does it give you the wrong answer?
it compiles,but It gives the wrong answer for square matrices of order greater than or equal to 4
Since there is probably an arithmetic error in your code, why not get the function DET to print out the matrix that it is given in a nice tabular form, as well as the cofactor so that you can check that everything is working as expected and you are getting the correct cofactor and associated minor?
Some general suggestions:  The return type of main is int, not void.
 Use more intuitive variable names, if i represents a column, call it col.
 Use brief comments to explain what's going on if you ever want anyone else to lay eyes on your code.
 Scrunching up code like if(i==0&&DIM==dim)for(j=0;j<100;j++)M[j]=100; makes it hard to read.
 Use const wherever you don't expect a variable to be changed, this is to prevent accidentally changing it and to enable some compiler optimizations: float DET(const float A[100][100], const int dim)
 Using static variables in a recursively called function is arcane. Rather than using static variables, why not pass the variables to each new function call, in this case, pass det and DIM as arguments to the function DET(), the first call to DET will be called with arguments det=0 and DIM=dim.
 You don't need a special case for dim==2; you can do a cofactor expansion on a 2x2 matrix as well, the minors in this case are just rank 1 matrices (i.e. numbers).
Why is det int while A is float?
Since there is probably an arithmetic error in your code, why not get the function DET to print out the matrix that it is given in a nice tabular form, as well as the cofactor so that you can check that everything is working as expected and you are getting the correct cofactor and associated minor?
Some general suggestions: The return type of main is int, not void.
 Use more intuitive variable names, if i represents a column, call it col.
 Use brief comments to explain what's going on if you ever want anyone else to lay eyes on your code.
 Scrunching up code like if(i==0&&DIM==dim)for(j=0;j<100;j++)M[j]=100; makes it hard to read.
 Use const wherever you don't expect a variable to be changed, this is to prevent accidentally changing it and to enable some compiler optimizations: float DET(const float A[100][100], const int dim)
 Using static variables in a recursively called function is arcane. Rather than using static variables, why not pass the variables to each new function call, in this case, pass det and DIM as arguments to the function DET(), the first call to DET will be called with arguments det=0 and DIM=dim.
 You don't need a special case for dim==2; you can do a cofactor expansion on a 2x2 matrix as well, the minors in this case are just rank 1 matrices (i.e. numbers).
Thanks for your first advice, I printed all the minors like you said but still can't figure out what's wrong, and sorry if the randomly chosen variable names cuased you a headache, so if there is something unclear to you I will clear it up. Here's the program: 
#include<stdio.h>

#include<conio.h>

#include<math.h>

int M[100];

float DET(float A[][100],int dim)

{

int i=100,j,k,l,m;

static float det=0;

static int DIM=dim;

if(dim>2)

for(i=0;i<DIM;i++)

{

if(i==0&&DIM==dim)for(j=0;j<100;j++)M[j]=100;

for(j=DIM1;j>=2;j)

if(M[j]==i)continue;

/*here printing starts*/

for(k=0;k<dim;k++)

{

printf("\n");

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

{

m=0;

for(l=DIM1;l>=dim;l)

if(j!=M[l])m++;

if(m==DIMdim)printf("%0.0f ",A[k][j]);

}

}

printf("\n\n");

/*here printing ends*/

M[dim1]=i;

det+=pow(1,i+dim1)*A[dim1][i]*DET(A,dim1);

}

if(i==DIM1)M[dim1]=100;

if(dim==2)

{

/*here printing starts*/

for(k=0;k<dim;k++)

{

printf("\n");

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

{

m=0;

for(l=DIM1;l>=dim;l)

if(j!=M[l])m++;

if(m==DIMdim)printf("%0.0f ",A[k][j]);

}

}

printf("\n\n");

/*here printing ends*/

for(i=0;i<DIM;i++)

{

k=0;

for(j=DIM1;j>=2;j)

if(i!=M[j])k++;

if(k==DIM2)break;

}

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

{

k=0;

for(l=DIM1;l>=2;l)

if(j!=M[l])k++;

if(k==DIM2&&j!=i)break;

}

return(A[0][i]*A[1][j]A[0][j]*A[1][i]);

}

if(dim==1)return(A[0][0]);

return(det);

}



void main()

{

float A[100][100];

int n,k,l;

puts("Input size of square matrix:");

scanf("%d",&n);

puts("Input square matrix:");

for(k=0;k<n;k++)

{

printf("\n");

for(l=0;l<n;l++)

{

printf("Input a%d%d: ",k+1,l+1);

scanf("%f",&A[k][l]);

}

}

printf("\n\nThe determenant of the matrix is %0.2f",DET(A,n));

getch();

}

So... were the minors displayed correct or not? For example, run your program on this invertible matrix and check the minors and cofactors are correct and have the right sign  .

(1 2 3 4)

det(1 2 1 1) = 12

(1 1 2 1)

(5 6 7 8)

and [code]...[/code] tags are good. Please use them.
So... were the minors displayed were correct or not? For example, run your program on this invertible matrix and check the minors and cofactors are correct and have the right sign  .

(1 2 3 4)

det(1 2 1 1) = 12

(1 1 2 1)

(5 6 7 8)

and [code]...[/code] tags are good. Please use them.
Yup correct (using my LUP function) ;)
kind regards,
Jos
Yup correct (using my LUP function) ;)
Phew! I usually prefer to work in special units where 1 = 1 = 2 = 1/2. In those units I never have to hunt down minus signs or factors of 2 and my answers are always correct. :)
Phew! I usually prefer to work in special units where 1 = 1 = 2 = 1/2. In those units I never have to hunt down minus signs or factors of 2 and my answers are always correct. :)
Well, my LUP implementation isn't the most efficient one when it comes to pivot
selection but then again it has to deal with symbolics as well and it does a fine
job when it comes to that e.g. 
 a b 

 c d  = a*db*c

It can do any larger dimensions as well ;)
kind regards,
Jos
So... were the minors displayed correct or not? For example, run your program on this invertible matrix and check the minors and cofactors are correct and have the right sign  .

(1 2 3 4)

det(1 2 1 1) = 12

(1 1 2 1)

(5 6 7 8)

and [code]...[/code] tags are good. Please use them.
OK, now I've perfected the program, and all the minors are displayed correctly, but It still gives the wrong answer, and I'm still trying to find out what's wrong.
here's the program, test it on C++(V5.02) if you have it: 
#include<stdio.h>

#include<conio.h>

#include<math.h>

int M[100];

float DET(float A[][100],int dim)

{

int i,j,k,l,m;

static float det=0;

static int DIM=dim;

if(dim>2)

for(i=0;i<DIM;i++)

{

if(i==0&&DIM==dim)for(j=0;j<100;j++)M[j]=100;

m=0;

for(j=DIM1;j>=2;j)

if(M[j]==i)m++;

if(m!=0)continue;

/*here printing starts*/

for(k=0;k<dim;k++)

{

printf("\n");

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

{

m=0;

for(l=DIM1;l>=2;l)

if(j!=M[l])m++;

if(m==DIM2)printf("%0.0f ",A[k][j]);

}

}

printf("\n\n");

/*here printing ends*/

M[dim1]=i;

det+=pow(1,i+dim1)*A[dim1][i]*DET(A,dim1);

M[dim1]=100;

}

if(dim==2)

{

/*here printing starts*/

for(k=0;k<dim;k++)

{

printf("\n");

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

{

m=0;

for(l=DIM1;l>=2;l)

if(j!=M[l])m++;

if(m==DIM2)printf("%0.0f ",A[k][j]);

}

}

printf("\n\n");

/*here printing ends*/

for(i=0;i<DIM;i++)

{

k=0;

for(j=DIM1;j>=2;j)

if(i!=M[j])k++;

if(k==DIM2)break;

}

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

{

k=0;

for(l=DIM1;l>=2;l)

if(j!=M[l])k++;

if(k==DIM2&&j!=i)break;

}

return(A[0][i]*A[1][j]A[0][j]*A[1][i]);

}

if(dim==1)return(A[0][0]);

return(det);

}



void main()

{

float A[100][100];

int n,k,l;

puts("Input size of square matrix:");

scanf("%d",&n);

puts("Input square matrix:");

for(k=0;k<n;k++)

{

printf("\n");

for(l=0;l<n;l++)

{

printf("Input a%d%d: ",k+1,l+1);

scanf("%f",&A[k][l]);

}

}

printf("\n\nThe determenant of the matrix is %0.2f",DET(A,n));

getch();

}

I just have one question:
When I write
det+=pow(1,i+dim1)*A[dim1][i]*DET(A,dim1); where the return value of the DET(A,dim1) function is det, is the value added to det just (sign)*A[dim1][i] multiplied by the determinant of its minor?
P.S: I tried your matrix, and got 8550.
When I write
det+=pow(1,i+dim1)*A[dim1][i]*DET(A,dim1); where the return value of the DET(A,dim1) function is det, is the value added to det just (sign)*A[dim1][i] multiplied by the determinant of its minor?
When you write X+= Y then the entire expression Y is evaluated and its value
is added to X for whatever the values of X and Y here the new value of X is
Y larger than it was before.
kind regards,
Jos
ps. you definitely should use other variable names and use a proper indentation
and spaces to make your code more readable.
When you write X+= Y then the entire expression Y is evaluated and its value
is added to X for whatever the values of X and Y here the new value of X is
Y larger than it was before.
kind regards,
Jos
ps. you definitely should use other variable names and use a proper indentation
and spaces to make your code more readable.
You didn't understand what I meant.
When I add to the value of the det static variable a return value which is that very same static variable(which is happening in the function as long as dim1 is not equal to 2), will it add itself twice? Or will it just add the return value associated with the dim1 part of the recursivity to the initial value of det in the part of the recursivity where I made the statement det+=pow(1,i+dim1)*A[dim1][i]*DET(A,dim1); ?
You didn't understand what I meant.
When I add to the value of the det static variable a return value which is that very same static variable(which is happening in the function as long as dim1 is not equal to 2), will it add itself twice? Or will it just add the return value associated with the dim1 part of the recursivity to the initial value of det in the part of the recursivity where I made the statement det+=pow(1,i+dim1)*A[dim1][i]*DET(A,dim1); ?
If the DET method in that last assignment expression also changes static variable
det then the entire thing causes undefined behaviour; you are changing the value
of an LHV (here: det) more than once before a sequence point is reached.
Anything can happen here.
kind regards,
Jos
curiously enough, you're really making your life difficult by insisting on having those static variables. :) Why don't you take heed of the comments in post #6?
curiously enough, you're really making your life difficult by insisting on having those static variables. :) Why don't you take heed of the comments in post #6?
I'm writing this so you don't find the program arcane anymore,PLEASE try to read it, cause it still gives the wrong answer for DIM greater than 3 
#include<stdio.h>

#include<conio.h>

#include<math.h>

int M[100];

float DET(float A[][100],int dim,int DIM,float det)

{

int i=100,j,k,l;

if(dim>2)

for(i=0;i<DIM;i++)

{

if(i==0&&DIM==dim)

for(j=0;j<100;j++)M[j]=100;

for(j=DIM1;j>=2;j)

if(M[j]==i)continue;

M[dim1]=i;

det+=pow(1,i+dim1)*A[dim1][i]*DET(A,dim1,DIM,det);

}

if(i==DIM1)M[dim1]=100;

if(dim==2)

{

for(i=0;i<DIM;i++)

{

k=0;

for(j=DIM1;j>=2;j)

if(i!=M[j])k++;

if(k==DIM2)break;

}

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

{

k=0;

for(l=DIM1;l>=2;l)

if(j!=M[l])k++;

if(k==DIM2&&j!=i)break;

}

return(A[0][i]*A[1][j]A[0][j]*A[1][i]);

}

if(dim==1)return(A[0][0]);

return(det);

}



void main()

{

float A[100][100];

int n,k,l;

puts("Input size of square matrix:");

scanf("%d",&n);

puts("Input square matrix:");

for(k=0;k<n;k++)

{

printf("\n");

for(l=0;l<n;l++)

{

printf("Input a%d%d: ",k+1,l+1);

scanf("%f",&A[k][l]);

}

}

printf("\n\nThe determenant of the matrix is %0.2f",DET(A,n,n,0));

getch();

}


if(i==0&&DIM==dim)

for(j=0;j<100;j++)M[j]=100;

for(j=DIM1;j>=2;j)

if(M[j]==i)continue;

M[dim1]=i;

This is still arcane. 
if(i==0&&DIM==dim)

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

M[j]=100;

for(j=DIM1;j>=2;j)

if(M[j]==i)continue;

M[dim1]=i;

This is less so.
No one here is going to debug your code for you, you'll have to do that yourself. You can get advice here on specific problems which is pretty good for free.
You don't need a special case for dim==2. That you continue to pollute your code with this nonspecial case seems to indicate that you don't fully understand how do do a minor expansion.
I still find your code is too compact and variable names abstruse, and the fact you can't get it to work proves you can't see what's going on either. Code should be written for human beings, not just for computers.
If your minors and cofactors are correct, then you should have gotten the correct answer. Therefore, I don't believe they are correct.
The minors expansion for the aforementioned matrix looks like this: 
1 2 3 4

1 2 1 1 2 1 1 1 1 1 1 2 1 1 2 1

1 1 2 1 = 1 1 2 1  2 1 2 1 + 3 1 1 1  41 1 2

5 6 7 8 6 7 8 5 7 8 5 6 8 5 6 7

Do you get these minors, with the columns in the right order and the correct cofactors and signs? Are you sure you then get the correct minors for the 3x3 matrices? Remember that swapping columns introduces minus signs.
No one here is going to debug your code for you, you'll have to do that yourself. You can get advice here on specific problems which is pretty good for free.
You don't need a special case for dim==2. That you continue to pollute your code with this nonspecial case seems to indicate that you don't fully understand how do do a minor expansion.
I still find your code is too compact and variable names abstruse, and the fact you can't get it to work proves you can't see what's going on either. Code should be written for human beings, not just for computers.
If your minors and cofactors are correct, then you should have gotten the correct answer. Therefore, I don't believe they are correct.
The minors expansion for the aforementioned matrix looks like this: 
1 2 3 4

1 2 1 1 2 1 1 1 1 1 1 2 1 1 2 1

1 1 2 1 = 1 1 2 1  2 1 2 1 + 3 1 1 1  41 1 2

5 6 7 8 6 7 8 5 7 8 5 6 8 5 6 7

Do you get these minors, with the columns in the right order and the correct cofactors and signs? Are you sure you then get the correct minors for the 3x3 matrices? Remember that swapping columns introduces minus signs.
I've run the program countless times and the minors were always perfecty correct, but the answer remained incorrect for matrices of order 4 or greater(for 3x3 matrices they are correct), and there is no column swapping in the program.
Anyway, I've simplified and explained the program here as much as possible for you, so if you can understand it finally, then tell me the problem.(by the way, this gives the same answers as before)
Here I explain with order of the code from up to down:
1.The skip_col integer array is used to know which columns are to be skipped when finding the minor matrix
2.The parameters of this function are the square matrix A, the number of rows which is changed by the recursivity, and the SIZE of the matrix which is a constant(which in this case is both the number of rows and columns since it is a square matrix)
3.det is the return value of the function
4.As you may have noticed, the funtion DET is called recursively from inside a for loop
5.this recursive funtion moves from the last row to the first row,and the for loop(the first one) is from the first column to the last column
6.everytime the function is called inside the for loop, the for loop is passed again to find all the minors of the minor of the pivot which was called which would be A[row1][col]
7.the step if(col==0&&row==size) is just to set the initial values of the array skip_col and the value det, it is only passed once in the entire program
8.skip_col is filled with 100's completely instead of zero's because unike 0, 100 is very unlikely to be found as a column's number
9.and det is assigned an initial value of zero
10.then, using a for loop I check if the column col is one of the columns that belong to the minor associated with the previous elements that were used in calling in the previous steps of the recursivity
11.using the integer test, which is always set to zero before this for loop, I test if this is one of the column numbers that are stored in skip_col
12.if test shows that this column does belong to skip_col, then continue is used to skip the remaining statements and check the next column col while on the same row
13.if col here is the right column, then first it is stored in skip_col. Notice that the elements of skip_col are stored in decreasing order(from row1 to 1, skip_col[0] is never used and its value will always stay 100)
14.Then I add to the value of det the element multiplied by its minor
15.everytime DET(A,row1,SIZE) recieves a return value the column associated with row1(which is stored in skip_col) is set back to 100
16.in if(row==1) is the return value after which recursivity goes backward, and this is the first row of the matrix
17.then same test as before
18.if test shows that col is the column that belongs to all the minors col is taken
19.the value is returned to the phase where row was equal to 2
20.det is returned everytime the last column is passed in the first for loop and it is the final return value 
#include<stdio.h>

#include<conio.h>

#include<math.h>

int skip_col[100];

float DET(float A[][100],int row,int SIZE)

{

int col,i,test;

float det;


if(row>1)

for(col=0;col<SIZE;col++)

{

if(col==0&&row==SIZE)

{

for(i=0;i<100;i++)

skip_col[i]=100;

det=0;

}

test=0;

for(i=SIZE1;i>1;i)

if(col==skip_col[i])test++;

if(test!=0)continue;

skip_col[row1]=col;

det+=pow(1,(row1)+col)*A[row1][col]*DET(A,row1,SIZE);

skip_col[row1]=100;

}


if(row==1)

{

for(col=0;col<SIZE;col++)

{

test=0;

for(i=SIZE1;i>1;i)

if(col==skip_col[i])test++;

if(test==0)break;

}

return(A[0][col]);

}


return(det);

}



void main()

{

float A[100][100];

int n,k,l;

puts("Input size of square matrix:");

scanf("%d",&n);

puts("Input square matrix:");

for(k=0;k<n;k++)

{

printf("\n");

for(l=0;l<n;l++)

{

printf("Input a%d%d: ",k+1,l+1);

scanf("%f",&A[k][l]);

}

}

printf("\n\nThe determenant of the matrix is %0.2f",DET(A,n,n));

getch();

}

Experts my ass, I knew I should have never posted here in the first place.
Experts my ass, I knew I should have never posted here in the first place.
Ok, goodbye and good luck with your code (a partial LUP decomposition would
have been much faster and easier to implement).
kind regards,
Jos
Experts my ass, I knew I should have never posted here in the first place.
No one is going to debug somebody else's trivial but complex code debugging of which ( by definition ) does not reward in any way ( e.g. 'I showed off my knowlegde of language constructions! I'm cool" or "This is because this algorithm that I know works not like implemented here" etc )
No one is going to debug somebody else's trivial but complex code debugging of which ( by definition ) does not reward in any way ( e.g. 'I showed off my knowlegde of language constructions! I'm cool" or "This is because this algorithm that I know works not like implemented here" etc )
I'm not asking anyone to debug my code, post #21 made the algorithm as clear as possible, anyone can understand just by reading it, but obviously none bothered.
I'm not asking anyone to debug my code, post #21 made the algorithm as clear as possible, anyone can understand just by reading it, but obviously none bothered.
I can't speak for others but at least I didn't bother to dig through that code and
you can't force anyone to feel bothered; that code is just highly inefficient even
if it does run properly.
kind regards,
Jos
I SOLVED IT !!!!!!!!!!!!!!!!!!!!!!
IT IS 100% CORRECT!
HERE IT IS ''EXPERTS'': 
#include<stdio.h>

#include<conio.h>

#include<math.h>

int skip_col[100];

float DET(float A[][100],int row,int SIZE)

{

int col,i,test;

float det=0;

int minor_col=0;


if(row>1)

for(col=0;col<SIZE;col++)

{

if(col==0&&row==SIZE)

{

for(i=0;i<100;i++)

skip_col[i]=100;

}

test=0;

for(i=SIZE1;i>1;i)

if(col==skip_col[i])test++;

if(test!=0)continue;

skip_col[row1]=col;

det+=pow(1,(row1)+minor_col)*A[row1][col]*DET(A,row1,SIZE);

minor_col++;

skip_col[row1]=100;

}


if(row==1)

{

for(col=0;col<SIZE;col++)

{

test=0;

for(i=SIZE1;i>=1;i)

if(col==skip_col[i])test++;

if(test==0)break;

}

return(A[row1][col]);

}


return(det);

}



void main()

{

float A[100][100];

int n,k,l;

puts("Input size of square matrix:");

scanf("%d",&n);

puts("Input square matrix:");

for(k=0;k<n;k++)

{

printf("\n");

for(l=0;l<n;l++)

{

printf("Input a%d%d: ",k+1,l+1);

scanf("%f",&A[k][l]);

}

}

printf("\n\nThe determenant of the matrix is %0.2f",DET(A,n,n));

getch();

}

READ IT AND MAYBE YOU'LL LEARN SOMETHING.
READ IT AND MAYBE YOU'LL LEARN SOMETHING.
Did *you* learn anything?
kind regards,
Jos (moderator)
I SOLVED IT !!!!!!!!!!!!!!!!!!!!!!
IT IS 100% CORRECT!
HERE IT IS ''EXPERTS'':
Experts are not those who rush to solve trivial tasks for free.
READ IT AND MAYBE YOU'LL LEARN SOMETHING.
I learned that a human equipped with teh brain is able to write and debug teh codez on his own.
p.s. And as you wrote that minors are calculated corectly but result is wrong  the bug was exactly in calculating final sum of products of minors and coefficients.
I SOLVED IT !!!!!!!!!!!!!!!!!!!!!!
IT IS 100% CORRECT!
HERE IT IS ''EXPERTS'':
Congratulations, and good effort.
I'd recommend three things, in the future, though:
1) use standard libraries as much as possible.
Obviously, at some point this will be impossible if you get a job as a programmer (outside of FOSS development), and you will use libraries on custom apps, but it's good practice for figuring out what is in those custom libraries to start now  looking through the libraries you have available to achieve the result you want.
On this note, I challenge you to remove conio.h from your program. I only glanced through your code, but it looks like there is only one reason you have it in there, and that functionality is easily duplicated. Conio itself is nonstandard whose implementation varies by version, and can cause issues if you were to distribute a package using a different version than is what the end users have  so it's good to get in the habit of not using things that you can replicate easily without.
2) Use a standard indentation pattern
This isn't Python where indentation affects execution (or compilation), but picking one of the more standard indentations (three spaces or a tab) will make your code much, much more readable
3) Comments
Commenting code is another way to increase readability and reuse  you can easily look at the description of a module or loop, its inputs and outputs, and either modify it or use it in another program (though if it's really that useful, you can make it into its own module that can be included...
Sign in to post your reply or Sign up for a free account.
Similar topics
by: aruna 
last post by:
i want a c program to find the determinant of matrix and inverse of matrix as two separate c programs .
please help me

by: naren 
last post by:
can anyone help with the code for determinant,cofactor and inverse of a
matrix in c++ lang?
i am not getting the logic.....

by: avdhoot 
last post by:
Hi Everybody,
I am doing some project in VB6 where I ahve to calculate the Determinant of the matrix. I have got a function MDETERM but not able to pass on the parameters of the matrix and get the...

by: James Stroud 
last post by:
Hello All,
I'm using numpy to calculate determinants of matrices that look like
this (13x13):

by: krishnai888 
last post by:
I had already asked this question long back but no one has replied to me..I hope someone replies to me because its very important for me as I am doing my internship.
I am currently writing a code...

by: pvsgangadhar 
last post by:
I need the program in clangauge to find the determinant of a matrix for
specified no.or rows and columns.

by: haderika 
last post by:
Hey,
I'm having trouble overloading the ~ operator (the determinant of the matrix) in a case of 2x2 matrices. So i have a matrix class, with the constructor, overloading +, += and ~ operators. the...

by: Glenton 
last post by:
Hi All
Here is a very simple little class for finding a shortest route on a network, following Dijkstra's Algorithm:
#!/usr/bin/env python
#This is meant to solve a maze with Dijkstra's...

by: CloudSolutions 
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...

by: Faith0G 
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

by: isladogs 
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...

by: ryjfgjl 
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...

by: Charles Arthur 
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone

by: aa123db 
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...

by: ryjfgjl 
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...

by: BarryA 
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

by: Sonnysonu 
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by columnwise with in the specific length.
suppose the i have to...
 