what is wrong in this code?
Spiral print anticlockwise
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 