Hello,

The code below is suppose to add up numbers from part of an array and print out the sum... I got it to print it out correctly earlier, but somehow it does not work at all anymore, its printing out 4... it looks like its not even getting the updated sum from the inner most for loop....

Can anyone help me fix this?

Code:

int Permute(int numGend, int couplemin[10][10]){
int z=0, sum=0, n=0, i=0, r=0, v=0, q=0;
int maxMin[20];
for(n=0; n < numGend; n++){
for(v=0; v < 2; v++){
sum=couplemin[0][n];
q=n;
if(v==0){
for(i=1; i < numGend; i++){
if(i==q){
q--;
i=q;
}
z++;
sum+=couplemin[z][i];
}
}
else if(v==1){
for(i=numGend-1; i >= numGend; i--){
z++;
sum+=couplemin[z][i];
}
}
maxMin[v]=sum;
z=0;
}
}
printf("%d\n", sum);
}