Can you please tell me where i am wrong!

#include
using namespace std;
int main()
{
int a[100][100];
int n;
cin>>n;
int sum=0;

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

for(int li=0;li<=n-1;li++)
{
    for(int lj=0;lj<=n-1;lj++)
    {
        for(int bi=li+1;bi<=n-1;bi++)
        {
            for(int bj=lj+1;bj<=n-1;bj++)
            {
                for(int i=li;i<=bi;i++)
                {
                    for(int j=lj;j<=bj;j++)
                    {
                        sum+=a[i][j];
        
                    }
                }
            }
        }
    }
}
cout<<sum;
return 0;

}

hey @beinganimus Use bi and bj from li and lj instead of li+1 and lj+1 respectively.
It is discarding some of the cases where the diff of either row is less than 1 or the column is less than 1 .

Hope it helps :blush: .
If your doubt is now resolved please mark it as resolved and rate me accordingly .
Else you can further questions here .
Thankyou