#include<bits/stdc++.h>
using namespace std;
int main()
{
int m,n;
cin>>m;
cin>>n;
int a[m][n];
int sum;
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
cin>>a[m][n];
}
}
for(int li=0;li<m;li++)
{
for(int lj=0;lj<n;lj++)
{
for(int bi=li;bi<m;bi++)
{
for(int bj=lj;bj<n;bj++)
{
sum=0;
for(int i=li;i<=bi;i++)
{
for(int j=lj;j<=bj;j++)
{
sum=sum+a[i][j];
}
}
cout<<sum<<endl;
}
}
}
}
}
This is my code regarding the algo taught in the video but the output is not as expected .
It is printing some garbage values every time