rowSum += v[i][j];
columnSum += v[j][i]; // Note the transposed index values.
You need to reset the sums back to 0 for each interation of "i", and you want to print the sums for each iteration of "i". (You'll need a couple lines of code between the fors and between the closing braces of the loops.)