Test case 1,2,5 fail

#include
using namespace std;
void sp(int a[100][100],int r,int c){
int sr=0,sc=0,er=r-1,ec=c-1;
while(sr<=er && sc<=ec){
for(int i=sc;i<=ec;i++){
cout<<a[sr][i]<<","<<" “;
}
sr++;
for(int j=sr;j<=er;j++){
cout<<a[j][ec]<<”,"<<" ";

	}
	ec--;
	for(int x=ec;x>=sc;x--){
		cout<<a[er][x]<<","<<" ";
	}
	er--;
	if(sr<er){
	for(int y=er;y>=sr;y--){
		cout<<a[y][sc]<<","<<" ";
	}
	sc++;
	}

}
cout<<"END";

}
int main() {
int r,c;cin>>r>>c;int a[100][100];
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
cin>>a[i][j];
}
}
sp(a,r,c);
return 0;
}

hi @yashtripathi6969_0cd127807d833066 updated and corrected

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.