Solution to max sum submatrix problem

My solution is as follows but I am not getting desired result. Can you please help?

#include
#include
using namespace std;

int maxSum_submatrix( int a[][100], int rows, int cols){

//Column wise addition first:
for (int r = rows - 1; r>=0; r--){
	for (int c = cols -2; c>=0; c--){
		a[r][c] += a[r][c+1];
	}
}
// Row wise addition:
for (int c = cols -1; c>=0; c--){
	for (int r = rows -2; r>=0; r--){
		a[r][c] += a[r+1][c];
	}
}

int maxSum = INT_MIN;
for (int i=0; i<rows; i++){
	for (int j=0; j<cols; j++){
		maxSum = max(maxSum, a[i][j]);
	}
}
return maxSum;

}

int main(){

int a[100][100] = {0};

int rows,cols;
cin>>rows>>cols;

for (int i=0; i<rows; i++){
	for (int j=0; j<cols; j++){
		cin>>a[rows][cols];
	}
}

cout<<maxSum_submatrix(a, rows, cols)<<endl;

return 0;

}

Please save your code on ide.codingblocks.com and then share its link.

Here is the link: https://ide.codingblocks.com/s/258259

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.