Why C and not C++ for i/o?
Why declare temporary values for indexing in advance? (i,j...) They should live and die in respective for loops, because you shouldn't need them afterwards.
Why 1-based indices and not 0-based? a 2x2 matrix should have values [0][0], [0][1], [1][0], [1][1], so it's pretty confusing when you're asking user to input value for cell [1][2].
Otherwise the logic looks okay-ish (might want a max_column variable to not depend on j). If you used better variable names, the answer would be clearer:
-- "row" instead of "i"
-- "col" instead of "j"
To get the column sums, you found (perhaps by chance?) to iterate over column before row.
line 23 --> printf("Sum of column #%d is: %d\n", j, sum);
Enter matrix[0][0] value: 1
Enter matrix[0][1] value: 2
Enter matrix[0][2] value: 3
Enter matrix[1][0] value: 4
Enter matrix[1][1] value: 6
Enter matrix[1][2] value: 5
Enter matrix[2][0] value: 7
Enter matrix[2][1] value: 9
Enter matrix[2][2] value: 8
Sum of column #0 is 12
Sum of column #1 is 17
Sum of column #2 is 16
Column #1 has a maximum sum of 17
So far we are using c in our classes. We haven't reached c++ yet, that's around the next semester. Our prof. wants [1,1], [1,2], [2,1], [2,2] kinda values.
And I forgot to remove line 23. It was only there as helping reference for the first few parts.
So it should look like this:
Okay, thanks for responses. Internally you should probably still do all the math and indexing with 0-based, since it's more natural. Just when you output messages to user, add 1. For example, printf("%d", row+1);
For remembering the best column --> see how I used the max_col variable. Remember this column as well as max sum.
Enter matrix[1][1] value: 4
Enter matrix[1][2] value: 3
Enter matrix[2][1] value: 2
Enter matrix[2][2] value: 1
Sum of column #1 is 6
Sum of column #2 is 4
Column #1 has a maximum sum of 6.