So i'm just trying to find the sum of rows and columns of this 2-d array. I keep getting the same output and feel like I'm not actually calculating a sum, here is what i have:
Well, you're already going through some of the rows. You can just sum up each row as you iterate through it. The row index will stay constant as you index through. The same sort of idea goes for summing up the columns.
When you go to (0, 0), that gives you '1', right? Going to (0, 1) would give you '2'? (0, 2) gives you '3', and so forth. You're iterating through 'row 0' and the row index stays the same as you vary the column index from 0 to numcols - 1. Just do that for each row.
Similarly for the column, but the order is switched and this time the column index stays the same as you vary the row index.
So, as you go through, you could so something like rowSum += array[row][col]
You just have to be sure to initialize rowSum to 0 at the beginning of each row.
Similarly for the column sum.