Sum of all submatrix approach 1

Please look into this, where is the problem

corrrect one

					for(int i=li; i<=bi; i++)
					{
						for(int j=lj; j<=bj; j++)
						{
							// cout<<"li="<<li<<"lj="<<lj<<"bi="<<bi<<"bj="<<bj<<"i="<<i<<"j="<<j<<endl;
							sum = sum + arr[i][j];
						}
					}