Why 1 test case is failed

#include
using namespace std;
void spirlprint(int a[][100],int n, int m){
int sr=0, sc=0, er=n-1, ec=m-1;
while(sr<=er and sc<=ec){
for(int col=sc; col<=ec; col++){
cout<<a[sr][col]<<", “;
}
sr++;
for(int row=sr; row<=er; row++){
cout<<a[row][ec]<<”, “;
}
ec–;
for(int col=ec; col>=sc; col–){
cout<<a[er][col]<<”, “;
}
er–;
for(int row=er; row>=sr; row–){
cout<<a[row][sc]<<”, ";
}
sc++;
}
cout<<“END”<<endl;
}
int main() {
int a[100][100];
int val=1;
int r,c;
cin>>r;
cin>>c;
for(int i=0; i<r; i++){
for(int j=0; j<c; j++){
a[i][j]=val;
val++;
}
}

spirlprint(a,r,c);
return 0;

}

hi @rathidevesh906_1dcc73a061c159bb,
updated and commented https://ide.codingblocks.com/s/662528

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.