Why the output is wrong

#include
using namespace std;
int main() {
int n,m,i,j,a[10][10],tl,br,sum=0;
cin>>n>>m;
for(i=0;i<n;i++)
{for(j=0;j<m;j++)
cin>>a[i][j];
}
for(i=0;i<n;i++)
{for(j=0;j<m;j++)
{tl=(i+1)(j+1);
br=(n-i)
(m-j);
sum=tlbra[i][j];
}
}

 cout<<sum;

}
input 2
2
1
1
1
1
output
4

Hi @garganshul151
In your code sum that you are computing should be
sum+=tlbra[i][j];
you have forgot to add previous sum to new sum.

Here is your corrected code :