#include
using namespace std;
int main()
{
int m,n,i,j,a[100][100];
cin>>m>>n;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cin>>a[i][j];
}
}
int startrow=0;
int startcol=0;
int endrow=m-1;
int endcol=n-1;
while(startrow<=endrow && startcol<=endcol)
{
//anticlockwise
//first col
{ {
for(int i=startrow;i<=endrow;i++)
cout<<a[i][startcol]<<", ";
}startcol++;
//endrow
{
for(int i=startcol;i<=endcol;i++)
cout<<a[endrow][i]<<", ";
}endrow--;
//endcol
if(endcol>=startcol){
for(int i=endrow;i>=startrow;i--)
cout<<a[i][endcol]<<", ";
}
endcol--;
//startrow
if(endrow>startrow){
for(int i=endcol;i>=startcol;i--)
cout<<a[startrow][i]<<", ";
}
startrow++;}
}cout<<βENDβ;
return 0;
}
code is absolutely running fine in pc compiler but failing one test case in coding blocks compiler