Why do you still have that mass of specific variables?
Here's a short example of what I meant. Try to think about the problem in array terms (using some loops) rather than endlessly copy/pasting increasingly complicated (and buggy) expressions.
Code:
#include <stdio.h>
int sumRow ( int arr[4][4], int row ) {
int sum = 0, col;
for ( col = 0 ; col < 4 ; col++ ) {
sum += arr[row][col];
}
return sum;
}
int sumCol ( int arr[4][4], int col ) {
int sum = 0, row;
for ( row = 0 ; row < 4 ; row++ ) {
sum += arr[row][col];
}
return sum;
}
int main ( ) {
int puzzle[4][4] = {
{ 1, 2, 3, 4 },
{ 11, 12, 13, 14 },
{ 21, 22, 23, 24 },
{ 31, 32, 33, 34 },
};
printf("%d\n", sumRow(puzzle,2) );
printf("%d\n", sumCol(puzzle,2) );
return 0;
}
$ ./a.exe
90
72
With a few well chosen functions, you should be able to do so much better.