Sir can ypu guide me what is wrong in this code.It is the code for array wave print column wise

#include
using namespace std;
int main()
{
int a[10][10];
int rows,columns,i,j;
//r-rows
cin>>rows;
cin>>columns;
for(i=0;i<rows;i++)
{
for(j=0;j<columns;j++)
{
cin>>a[i][j];
}

}


for(j=0;j<columns;j++)
{
    if(j%2==0)
    {

        for(i=0;i<rows;i++)
        {
            cout<<a[i][j]<<",";
        }
    }
    else
    {
        for(i=rows-1;i>=0;i--)
        {
            cout<<a[i][j]<<",";
        }
    }
}

cout<<"END";
return 0;

}

@harshulgarg21
Your approach is correct. The problem is with your output format. You missed to print the space after each comma.

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.