why this code is not working
sum of submarix approach 2
#include
using namespace std;
int main()
{
int n,m;
cout<<"enter the value of n and m : "<<endl;
cin>>n>>m;
int a[n][m];
cout<<“enter the elements of an array :”<<endl;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin>>a[i][j];
}
}
cout<<"our array is : “<<endl;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cout<<a[i][j]<<” ";
}
cout<<endl;
}
int ps[n][m];
ps[0][0]=a[0][0];
for(int i=1;i<n;i++)
{
ps[i][0]=ps[i-1][0]+a[i][0];
}
for(int j=1;j<m;j++)
{
ps[0][j]=ps[0][j-1]+a[0][j];
}
for(int i=1;i<n;i++)
{
for(int j=1;j<m;j++)
{
ps[i][j]=ps[i][j-1]+ps[i-1][j]-ps[i-1][j-1]+a[i][j];
}
}
int sum;
for(int li=0;li<n;li++)
{
for(int lj=0;lj<m;lj++)
{
for(int bi=li;bi<n;bi++)
{
for(int bj=lj;bj<m;bj++)
{
sum+=ps[bi][bj]+ps[li-1][bj]-ps[bi][lj-1]+ps[li-1][lj-1];
}
}
}
}
cout<<“the sum of submatrix is :”<<sum<<endl;
}