Can you please tell me what is wrong in the code as one test case is failing
#include
#include
using namespace std;
void print2darray(int a[100][100],int n,int m){
int i,j;
for(i=0;i<n;i++){
for(j=0;j<m;j++){
cout<<a[i][j]<<’ ';
}
cout<<endl;
}
}
int main(){
int n,m,num,sr,sc,er,ec,i,j,k,l,row,col;
cin>>n>>m;
int a[100][100] = {};
for(i=0;i<n;i++){
for(j=0;j<m;j++){
cin>>num;
a[i][j] = num;
}
}
sr = 0;
sc = 0;
er = n-1;
ec = m-1;
while(sr<=sc && sc<=ec){
for(row=sr;row<=er;row++){
cout<<a[row][sc]<<", ";
}
sc++;
for(col=sc;col<=ec;col++){
cout<<a[er][col]<<", ";
}
er--;
if(sc<ec){
for(row=er;row>=sr;row--){
cout<<a[row][ec]<<", ";
}
ec--;
}
if(sr<er){
for(col=ec;col>=sc;col--){
cout<<a[sr][col]<<", ";
}
sr++;
}
}
cout<<"END";
return 0;
}