Please check this and let me know why one testcase is getting wrong

#include
using namespace std;
void spiralprint(int a[10][10], int m, int n){
int sm=0;
int sn=0;
int em=m-1;
int en=n-1;
while(sm<em && sn<en){
for(int row=sm; row<=em; row++){
cout<<a[row][sn]<<", β€œ;
}
for(int col=sn+1; col<=en; col++){
cout<<a[em][col]<<”, β€œ;
}
for(int row=em-1; row>=sm; row–){
cout<<a[row][en]<<”, β€œ;
}
for(int col=en-1; col>=sn+1; col–){
cout<<a[sm][col]<<”, β€œ;
}
sm++;
sn++;
em–;
en–;
}
if(sm<em){
for(int row=sm; row<=em; row++){
cout<<a[row][sn]<<”, β€œ;
}
}
else if(sn<en){
for(int col=sn; col<=en; col++){
cout<<a[sm][col]<<”, β€œ;
}
}
else if(sm==em && sn==en && sm==sn){
cout<<a[sm][sn]<<”, ";
}
cout<<β€œEND”;
}
int main(){
int m;
int n;
cin>>m>>n;
int a[10][10];
for(int i=0; i<m; i++){
for(int j=0; j<n; j++){
cin>>a[i][j];
}
}
spiralprint(a,m,n);
}

hi @jharshitjindal_4da85e4d0b87909f,
refer
https://ide.codingblocks.com/s/667379

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.