Spiral print anticlockwise

what is wrong in this code?

Hey @shubhangis248

   if(startcol<=endcol) // here it should be <=
    {
    for(int i=startrow;i<=endrow;i++)
    {
        cout<<a[i][startcol]<<", ";
    }
    startcol++;
    }

 //endrow
 if(startrow<=endrow) //// here it should be <=
 {
 for(int i=startcol;i<=endcol;i++)
 {
     cout<<a[endrow][i]<<", ";
 }
 endrow--;
 } 

Also add at last (required by the question)

cout<<"END"; 

If this resolves ur query then please mark it as resolved :slight_smile: