Implementing O(n^6) approach

I tried implementing the same approach and at first only li=0 and lj=0 and bi=1 and bj=1 so the sum comes out to be 1.

int sum=0;
for(int li=0;li<nrow;li++){
for(int lj=0;lj<ncol;lj++){
cout<<"li is “<<li<<” lj is "<<lj<<endl;
for(int bi=li+1;bi<nrow;bi++){
for(int bj=lj+1;bj<ncol;bj++){

                cout<<"bi is "<<bi<<" bj is "<<bj<<endl;
                for(int i=li;i<bi;i++){
                    for(int j=lj;j<bj;j++){
                       cout<<"a["<<i<<"]["<<j<<"]: "<<a[i][j]<<endl;


hi @riagoel3999 in vid few things are wrong on in for loop please refer this

ive commented