Array wave print column wise

None of my testcases are passed but i m getting output same as shown in the example .
here is my code
https://ide.codingblocks.com/s/43057
can u pls help where i have made mistakes

There should be space in output.
Also your code doesn’t work well on many cases like

when input is
3 4
11 12 13 14
21 22 23 24
31 32 33 34

It gives output
11,21,31,32,22,12,13,23,33,34,31,21,END

which is wrong.

yeah thanks i noticed it and i got all the testcases passed

can you plz check this code what’s wrong in this

#include
using namespace std;
int main() {
int m,n;
int a[10][10];
cin>>m>>n;
if((m>=1 && m<=10) && (n>=1 && n<=10))
{
for(int r=0;r<n;r++)
{
for(int c=0;c<m;c++)
{
cin>>a[r][c];
}
}

for(int c=0;c<m;c++)
{
	if(c%2==0)
	{
		for(int r=0;r<n;r++)
		{
			cout<<a[r][c]<<", ";
		}
	}
	else
	{
		for(int r=n-1;r>=0;r--)
		{
			cout<<a[r][c]<<", ";
		}
	}
}
}
cout<<"End";
return 0;

}#include
using namespace std;
int main() {
int m,n;
int a[10][10];
cin>>m>>n;
if((m>=1 && m<=10) && (n>=1 && n<=10))
{
for(int r=0;r<n;r++)
{
for(int c=0;c<m;c++)
{
cin>>a[r][c];
}
}

for(int c=0;c<m;c++)
{
	if(c%2==0)
	{
		for(int r=0;r<n;r++)
		{
			cout<<a[r][c]<<", ";
		}
	}
	else
	{
		for(int r=n-1;r>=0;r--)
		{
			cout<<a[r][c]<<", ";
		}
	}
}
}
cout<<"End";
return 0;

}

//please check this i corrected your code although your code was correct but they miss one condition which you mention (1-10).